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 <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Johannes Schindelin committed
Jun 18, 2015 at 18:38 UTC
0e0aff4b4ca93053a83578cb040475c6e3185f2d
2 files changed
+6
-2
git-rebase--interactive.sh
+5
-1
@@ -836,7 +836,11 @@ continue)
836
# do we have anything to commit?
837
if git diff-index --cached --quiet HEAD --
838
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"
844
else
845
if ! test -f "$author_script"
846
then
t/t3404-rebase-interactive.sh
+1
-1
@@ -1039,7 +1039,7 @@ test_expect_success 'short SHA-1 collide' '
1039
)
1040
'
1041
1042
-test_expect_failure 'rebase --continue removes CHERRY_PICK_HEAD' '
1042
+test_expect_success 'rebase --continue removes CHERRY_PICK_HEAD' '
1043
git checkout -b commit-to-skip &&
1044
for double in X 3 1
1045
do