Skip to content

Commit d17ec3a

Browse files
dschogitster
authored andcommitted
t3404: demonstrate CHERRY_PICK_HEAD bug
When rev-list's --cherry option does not detect that a patch has already been applied upstream, an interactive rebase would offer to reapply it and consequently stop at that patch with a failure, mentioning that the diff is empty. Traditionally, a `git rebase --continue` simply skips the commit in such a situation. However, as pointed out by Gábor Szeder, this leaves a CHERRY_PICK_HEAD behind, making the Git prompt believe that a cherry pick is still going on. This commit adds a test case demonstrating this bug. Signed-off-by: Johannes Schindelin <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent fdf96a2 commit d17ec3a

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

t/t3404-rebase-interactive.sh

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1039,4 +1039,25 @@ test_expect_success 'short SHA-1 collide' '
10391039
)
10401040
'
10411041

1042+
test_expect_failure 'rebase --continue removes CHERRY_PICK_HEAD' '
1043+
git checkout -b commit-to-skip &&
1044+
for double in X 3 1
1045+
do
1046+
test_seq 5 | sed "s/$double/&&/" >seq &&
1047+
git add seq &&
1048+
test_tick &&
1049+
git commit -m seq-$double
1050+
done &&
1051+
git tag seq-onto &&
1052+
git reset --hard HEAD~2 &&
1053+
git cherry-pick seq-onto &&
1054+
set_fake_editor &&
1055+
test_must_fail env FAKE_LINES= git rebase -i seq-onto &&
1056+
test -d .git/rebase-merge &&
1057+
git rebase --continue &&
1058+
git diff --exit-code seq-onto &&
1059+
test ! -d .git/rebase-merge &&
1060+
test ! -f .git/CHERRY_PICK_HEAD
1061+
'
1062+
10421063
test_done

0 commit comments

Comments
 (0)