Skip to content

Commit 9a6682b

Browse files
committed
Merge branch 'maint-1.6.1' into maint
* maint-1.6.1: builtin-revert.c: release index lock when cherry-picking an empty commit
2 parents d57f07e + 0d66e95 commit 9a6682b

File tree

2 files changed

+34
-0
lines changed

2 files changed

+34
-0
lines changed

builtin-revert.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -376,6 +376,7 @@ static int revert_or_cherry_pick(int argc, const char **argv)
376376
(write_cache(index_fd, active_cache, active_nr) ||
377377
commit_locked_index(&index_lock)))
378378
die("%s: Unable to write new index file", me);
379+
rollback_lock_file(&index_lock);
379380

380381
if (!clean) {
381382
add_to_msg("\nConflicts:\n\n");

t/t3505-cherry-pick-empty.sh

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
#!/bin/sh
2+
3+
test_description='test cherry-picking an empty commit'
4+
5+
. ./test-lib.sh
6+
7+
test_expect_success setup '
8+
9+
echo first > file1 &&
10+
git add file1 &&
11+
test_tick &&
12+
git commit -m "first" &&
13+
14+
git checkout -b empty-branch &&
15+
test_tick &&
16+
git commit --allow-empty -m "empty"
17+
18+
'
19+
20+
test_expect_code 1 'cherry-pick an empty commit' '
21+
22+
git checkout master &&
23+
git cherry-pick empty-branch
24+
25+
'
26+
27+
test_expect_success 'index lockfile was removed' '
28+
29+
test ! -f .git/index.lock
30+
31+
'
32+
33+
test_done

0 commit comments

Comments
 (0)