summaryrefslogtreecommitdiff
path: root/builtin/merge.c
diff options
context:
space:
mode:
authorLibravatar Nguyễn Thái Ngọc Duy <pclouds@gmail.com>2011-12-15 20:47:22 +0700
committerLibravatar Junio C Hamano <gitster@pobox.com>2011-12-15 10:46:42 -0800
commit13f8b72d8c8e24215a3dd7771592b30083f1c740 (patch)
tree090da017d258dc9d29af8c270d287f61d44b150a /builtin/merge.c
parentmerge: abort if fails to commit (diff)
downloadtgif-13f8b72d8c8e24215a3dd7771592b30083f1c740.tar.xz
Convert commit_tree() to take strbuf as message
There wan't a way for commit_tree() to notice if the message the caller prepared contained a NUL byte, as it did not take the length of the message as a parameter. Use a pointer to a strbuf instead, so that we can either choose to allow low-level plumbing commands to make commits that contain NUL byte in its message, or forbid NUL everywhere by adding the check in commit_tree(), in later patches. Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/merge.c')
-rw-r--r--builtin/merge.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/builtin/merge.c b/builtin/merge.c
index 27576c0f7f..e066bf1b0b 100644
--- a/builtin/merge.c
+++ b/builtin/merge.c
@@ -913,7 +913,7 @@ static int merge_trivial(struct commit *head)
parent->next->item = remoteheads->item;
parent->next->next = NULL;
prepare_to_commit();
- if (commit_tree(merge_msg.buf, result_tree, parent, result_commit, NULL))
+ if (commit_tree(&merge_msg, result_tree, parent, result_commit, NULL))
die(_("failed to write commit object"));
finish(head, result_commit, "In-index merge");
drop_save();
@@ -945,7 +945,7 @@ static int finish_automerge(struct commit *head,
strbuf_addch(&merge_msg, '\n');
prepare_to_commit();
free_commit_list(remoteheads);
- if (commit_tree(merge_msg.buf, result_tree, parents, result_commit, NULL))
+ if (commit_tree(&merge_msg, result_tree, parents, result_commit, NULL))
die(_("failed to write commit object"));
strbuf_addf(&buf, "Merge made by the '%s' strategy.", wt_strategy);
finish(head, result_commit, buf.buf);