Skip to content

Commit

Permalink
Merge branch 'js/rebase-i-clean-up-upon-continue-to-skip' into maint
Browse files Browse the repository at this point in the history
Abandoning an already applied change in "git rebase -i" with
"--continue" left CHERRY_PICK_HEAD and confused later steps.

* js/rebase-i-clean-up-upon-continue-to-skip:
  rebase -i: do not leave a CHERRY_PICK_HEAD file behind
  t3404: demonstrate CHERRY_PICK_HEAD bug
  • Loading branch information
Junio C Hamano committed Aug 3, 2015
2 parents de67af4 + 0e0aff4 commit 29dce32
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
6 changes: 5 additions & 1 deletion git-rebase--interactive.sh
Original file line number Diff line number Diff line change
Expand Up @@ -849,7 +849,11 @@ continue)
# do we have anything to commit?
if git diff-index --cached --quiet HEAD --
then
: Nothing to commit -- skip this
# Nothing to commit -- skip this commit

test ! -f "$GIT_DIR"/CHERRY_PICK_HEAD ||
rm "$GIT_DIR"/CHERRY_PICK_HEAD ||
die "Could not remove CHERRY_PICK_HEAD"
else
if ! test -f "$author_script"
then
Expand Down
21 changes: 21 additions & 0 deletions t/t3404-rebase-interactive.sh
Original file line number Diff line number Diff line change
Expand Up @@ -1102,4 +1102,25 @@ test_expect_success 'rebase -i commits that overwrite untracked files (no ff)' '
test $(git cat-file commit HEAD | sed -ne \$p) = I
'

test_expect_success 'rebase --continue removes CHERRY_PICK_HEAD' '
git checkout -b commit-to-skip &&
for double in X 3 1
do
test_seq 5 | sed "s/$double/&&/" >seq &&
git add seq &&
test_tick &&
git commit -m seq-$double
done &&
git tag seq-onto &&
git reset --hard HEAD~2 &&
git cherry-pick seq-onto &&
set_fake_editor &&
test_must_fail env FAKE_LINES= git rebase -i seq-onto &&
test -d .git/rebase-merge &&
git rebase --continue &&
git diff --exit-code seq-onto &&
test ! -d .git/rebase-merge &&
test ! -f .git/CHERRY_PICK_HEAD
'

test_done

0 comments on commit 29dce32

Please sign in to comment.