Skip to content

Commit 6b3c4c0

Browse files
pcloudsgitster
authored andcommitted
merge: abort if fails to commit
Signed-off-by: Nguyễn Thái Ngọc Duy <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 406da78 commit 6b3c4c0

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

builtin/merge.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -913,7 +913,8 @@ static int merge_trivial(struct commit *head)
913913
parent->next->item = remoteheads->item;
914914
parent->next->next = NULL;
915915
prepare_to_commit();
916-
commit_tree(merge_msg.buf, result_tree, parent, result_commit, NULL);
916+
if (commit_tree(merge_msg.buf, result_tree, parent, result_commit, NULL))
917+
die(_("failed to write commit object"));
917918
finish(head, result_commit, "In-index merge");
918919
drop_save();
919920
return 0;
@@ -944,7 +945,8 @@ static int finish_automerge(struct commit *head,
944945
strbuf_addch(&merge_msg, '\n');
945946
prepare_to_commit();
946947
free_commit_list(remoteheads);
947-
commit_tree(merge_msg.buf, result_tree, parents, result_commit, NULL);
948+
if (commit_tree(merge_msg.buf, result_tree, parents, result_commit, NULL))
949+
die(_("failed to write commit object"));
948950
strbuf_addf(&buf, "Merge made by the '%s' strategy.", wt_strategy);
949951
finish(head, result_commit, buf.buf);
950952
strbuf_release(&buf);

0 commit comments

Comments
 (0)