diff options
author | Jeff King <peff@peff.net> | 2014-06-10 17:36:52 -0400 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2014-06-12 10:29:41 -0700 |
commit | 3ffefb54c0515308ceafb6ba071567d9fd379498 (patch) | |
tree | bc4051d445ad039b8e1df96c08c7641d711de22c /notes-cache.c | |
parent | bce14aa132e0064d9a9b1c7ad98e71e22c6e0272 (diff) | |
download | git-3ffefb54c0515308ceafb6ba071567d9fd379498.tar.gz git-3ffefb54c0515308ceafb6ba071567d9fd379498.tar.xz |
commit_tree: take a pointer/len pair rather than a const strbuf
While strbufs are pretty common throughout our code, it is
more flexible for functions to take a pointer/len pair than
a strbuf. It's easy to turn a strbuf into such a pair (by
dereferencing its members), but less easy to go the other
way (you can strbuf_attach, but that has implications about
memory ownership).
This patch teaches commit_tree (and its associated callers
and sub-functions) to take such a pair for the commit
message rather than a strbuf. This makes passing the buffer
around slightly more verbose, but means we can get rid of
some dangerous strbuf_attach calls in the next patch.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'notes-cache.c')
-rw-r--r-- | notes-cache.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/notes-cache.c b/notes-cache.c index eabe4a0d9..9d27b66eb 100644 --- a/notes-cache.c +++ b/notes-cache.c @@ -59,7 +59,7 @@ int notes_cache_write(struct notes_cache *c) return -1; strbuf_attach(&msg, c->validity, strlen(c->validity), strlen(c->validity) + 1); - if (commit_tree(&msg, tree_sha1, NULL, commit_sha1, NULL, NULL) < 0) + if (commit_tree(msg.buf, msg.len, tree_sha1, NULL, commit_sha1, NULL, NULL) < 0) return -1; if (update_ref("update notes cache", c->tree.ref, commit_sha1, NULL, 0, QUIET_ON_ERR) < 0) |