Skip to content

Commit

Permalink
merge: abort if fails to commit
Browse files Browse the repository at this point in the history
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Nguyễn Thái Ngọc Duy authored and Junio C Hamano committed Dec 15, 2011
1 parent 406da78 commit 6b3c4c0
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions builtin/merge.c
Original file line number Diff line number Diff line change
Expand Up @@ -913,7 +913,8 @@ static int merge_trivial(struct commit *head)
parent->next->item = remoteheads->item;
parent->next->next = NULL;
prepare_to_commit();
commit_tree(merge_msg.buf, result_tree, parent, result_commit, NULL);
if (commit_tree(merge_msg.buf, result_tree, parent, result_commit, NULL))
die(_("failed to write commit object"));
finish(head, result_commit, "In-index merge");
drop_save();
return 0;
Expand Down Expand Up @@ -944,7 +945,8 @@ static int finish_automerge(struct commit *head,
strbuf_addch(&merge_msg, '\n');
prepare_to_commit();
free_commit_list(remoteheads);
commit_tree(merge_msg.buf, result_tree, parents, result_commit, NULL);
if (commit_tree(merge_msg.buf, 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);
strbuf_release(&buf);
Expand Down

0 comments on commit 6b3c4c0

Please sign in to comment.