summaryrefslogtreecommitdiff
path: root/builtin/commit.c
diff options
context:
space:
mode:
authorLibravatar Jeff King <peff@peff.net>2014-06-10 17:36:52 -0400
committerLibravatar Junio C Hamano <gitster@pobox.com>2014-06-12 10:29:41 -0700
commit3ffefb54c0515308ceafb6ba071567d9fd379498 (patch)
treebc4051d445ad039b8e1df96c08c7641d711de22c /builtin/commit.c
parentSync with 1.9.4 (diff)
downloadtgif-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.c')
-rw-r--r--builtin/commit.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/builtin/commit.c b/builtin/commit.c
index 9cfef6c6cc..8b85df475b 100644
--- a/builtin/commit.c
+++ b/builtin/commit.c
@@ -1659,8 +1659,8 @@ int cmd_commit(int argc, const char **argv, const char *prefix)
append_merge_tag_headers(parents, &tail);
}
- if (commit_tree_extended(&sb, active_cache_tree->sha1, parents, sha1,
- author_ident.buf, sign_commit, extra)) {
+ if (commit_tree_extended(sb.buf, sb.len, active_cache_tree->sha1,
+ parents, sha1, author_ident.buf, sign_commit, extra)) {
rollback_index_files();
die(_("failed to write commit object"));
}