diff options
-rw-r--r-- | builtin-merge.c | 1 | ||||
-rwxr-xr-x | t/t6026-merge-attr.sh | 22 |
2 files changed, 23 insertions, 0 deletions
diff --git a/builtin-merge.c b/builtin-merge.c index b857cf624..bb09e6fb3 100644 --- a/builtin-merge.c +++ b/builtin-merge.c @@ -576,6 +576,7 @@ static int try_merge_strategy(const char *strategy, struct commit_list *common, (write_cache(index_fd, active_cache, active_nr) || commit_locked_index(lock))) die ("unable to write %s", get_index_file()); + rollback_lock_file(lock); return clean ? 0 : 1; } else { args = xmalloc((4 + commit_list_count(common) + diff --git a/t/t6026-merge-attr.sh b/t/t6026-merge-attr.sh index 56fc34176..86f47ca59 100755 --- a/t/t6026-merge-attr.sh +++ b/t/t6026-merge-attr.sh @@ -142,4 +142,26 @@ test_expect_success 'custom merge backend' ' rm -f $o $a $b ' +test_expect_success 'up-to-date merge without common ancestor' ' + test_create_repo repo1 && + test_create_repo repo2 && + test_tick && + ( + cd repo1 && + >a && + git add a && + git commit -m initial + ) && + test_tick && + ( + cd repo2 && + git commit --allow-empty -m initial + ) && + test_tick && + ( + cd repo1 && + git pull ../repo2 master + ) +' + test_done |