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 /builtin/commit-tree.c | |
parent | Sync with 1.9.4 (diff) | |
download | tgif-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 'builtin/commit-tree.c')
-rw-r--r-- | builtin/commit-tree.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/builtin/commit-tree.c b/builtin/commit-tree.c index 987a4c3d73..8a66c74e0f 100644 --- a/builtin/commit-tree.c +++ b/builtin/commit-tree.c @@ -123,8 +123,8 @@ int cmd_commit_tree(int argc, const char **argv, const char *prefix) die_errno("git commit-tree: failed to read"); } - if (commit_tree(&buffer, tree_sha1, parents, commit_sha1, - NULL, sign_commit)) { + if (commit_tree(buffer.buf, buffer.len, tree_sha1, parents, + commit_sha1, NULL, sign_commit)) { strbuf_release(&buffer); return 1; } |