merge: abort if fails to commit
authorNguyễn Thái Ngọc Duy <pclouds@gmail.com>
Thu, 15 Dec 2011 13:47:21 +0000 (20:47 +0700)
committerJunio C Hamano <gitster@pobox.com>
Thu, 15 Dec 2011 18:26:40 +0000 (10:26 -0800)
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/merge.c

index 2870a6af6fbc868455f2961483cfbfdb065a1a14..27576c0f7fa3bf370437f3ba1cd4e7ff36fadfdb 100644 (file)
@@ -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;
@@ -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);