@matheusbsbs / matheus-bagliano / commits / 4271666046
Fork 0

builtin-merge: release the lockfile in try_merge_strategy()

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>

Miklos Vajna committed Sep 6, 2008 at 18:29 UTC 4271666046b4b3e655eab88821096539099f3b14
2 files changed +23
builtin-merge.c
+1
@@ -576,6 +576,7 @@ static int try_merge_strategy(const char *strategy, struct commit_list *common,
576 (write_cache(index_fd, active_cache, active_nr) ||
577 commit_locked_index(lock)))
578 die ("unable to write %s", get_index_file());
579 + rollback_lock_file(lock);
580 return clean ? 0 : 1;
581 } else {
582 args = xmalloc((4 + commit_list_count(common) +
t/t6026-merge-attr.sh
+22
@@ -142,4 +142,26 @@ test_expect_success 'custom merge backend' '
142 rm -f $o $a $b
143 '
144
145 +test_expect_success 'up-to-date merge without common ancestor' '
146 + test_create_repo repo1 &&
147 + test_create_repo repo2 &&
148 + test_tick &&
149 + (
150 + cd repo1 &&
151 + >a &&
152 + git add a &&
153 + git commit -m initial
154 + ) &&
155 + test_tick &&
156 + (
157 + cd repo2 &&
158 + git commit --allow-empty -m initial
159 + ) &&
160 + test_tick &&
161 + (
162 + cd repo1 &&
163 + git pull ../repo2 master
164 + )
165 +'
166 +
167 test_done