Skip to content

Commit 0e0aff4

Browse files
dschogitster
authored andcommitted
rebase -i: do not leave a CHERRY_PICK_HEAD file behind
When skipping commits whose changes were already applied via `git rebase --continue`, we need to clean up said file explicitly. The same is not true for `git rebase --skip` because that will execute `git reset --hard` as part of the "skip" handling in git-rebase.sh, even before git-rebase--interactive.sh is called. Signed-off-by: Johannes Schindelin <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent d17ec3a commit 0e0aff4

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

git-rebase--interactive.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -836,7 +836,11 @@ continue)
836836
# do we have anything to commit?
837837
if git diff-index --cached --quiet HEAD --
838838
then
839-
: Nothing to commit -- skip this
839+
# Nothing to commit -- skip this commit
840+
841+
test ! -f "$GIT_DIR"/CHERRY_PICK_HEAD ||
842+
rm "$GIT_DIR"/CHERRY_PICK_HEAD ||
843+
die "Could not remove CHERRY_PICK_HEAD"
840844
else
841845
if ! test -f "$author_script"
842846
then

t/t3404-rebase-interactive.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1039,7 +1039,7 @@ test_expect_success 'short SHA-1 collide' '
10391039
)
10401040
'
10411041

1042-
test_expect_failure 'rebase --continue removes CHERRY_PICK_HEAD' '
1042+
test_expect_success 'rebase --continue removes CHERRY_PICK_HEAD' '
10431043
git checkout -b commit-to-skip &&
10441044
for double in X 3 1
10451045
do

0 commit comments

Comments
 (0)