summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--builtin/merge.c8
-rwxr-xr-xt/t7605-merge-resolve.sh2
2 files changed, 9 insertions, 1 deletions
diff --git a/builtin/merge.c b/builtin/merge.c
index 41467e4..eb94151 100644
--- a/builtin/merge.c
+++ b/builtin/merge.c
@@ -822,6 +822,14 @@ static int merge_trivial(struct commit *head, struct commit_list *remoteheads)
{
unsigned char result_tree[20], result_commit[20];
struct commit_list *parents, **pptr = &parents;
+ static struct lock_file lock;
+
+ hold_locked_index(&lock, 1);
+ refresh_cache(REFRESH_QUIET);
+ if (active_cache_changed &&
+ write_locked_index(&the_index, &lock, COMMIT_LOCK))
+ return error(_("Unable to write index."));
+ rollback_lock_file(&lock);
write_tree_trivial(result_tree);
printf(_("Wonderful.\n"));
diff --git a/t/t7605-merge-resolve.sh b/t/t7605-merge-resolve.sh
index 2f80037..5d56c38 100755
--- a/t/t7605-merge-resolve.sh
+++ b/t/t7605-merge-resolve.sh
@@ -43,7 +43,7 @@ merge_c1_to_c2_cmds='
test_expect_success 'merge c1 to c2' "$merge_c1_to_c2_cmds"
-test_expect_failure 'merge c1 to c2, again' "$merge_c1_to_c2_cmds"
+test_expect_success 'merge c1 to c2, again' "$merge_c1_to_c2_cmds"
test_expect_success 'merge c2 to c3 (fails)' '
git reset --hard c2 &&