Skip to content

Commit

Permalink
builtin-merge: release the lockfile in try_merge_strategy()
Browse files Browse the repository at this point in the history
Once we committed the locked index, we should release the lockfile. In
most cases this is done automatically when the process ends, but this is
not true in this case.

[jc: with additional tests from Eric Raible]

Signed-off-by: Miklos Vajna <vmiklos@frugalware.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Miklos Vajna authored and Junio C Hamano committed Sep 7, 2008
1 parent a6f63ae commit 4271666
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
1 change: 1 addition & 0 deletions builtin-merge.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) +
Expand Down
22 changes: 22 additions & 0 deletions t/t6026-merge-attr.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 4271666

Please sign in to comment.