The mechanism to prevent "git commit" from making an empty commit
or amending during an interrupted cherry-pick was broken during the
rewrite of "git rebase" in C, which has been corrected.
* pw/advise-rebase-skip:
commit: give correct advice for empty commit during a rebase
commit: encapsulate determine_whence() for sequencer
commit: use enum value for multiple cherry-picks
sequencer: write CHERRY_PICK_HEAD for reword and edit
cherry-pick: check commit error messages
cherry-pick: add test for `--skip` advice in `git commit`
t3404: use test_cmp_rev
@ -59,6 +59,9 @@ N_("The previous cherry-pick is now empty, possibly due to conflict resolution.\
@@ -59,6 +59,9 @@ N_("The previous cherry-pick is now empty, possibly due to conflict resolution.\
" git commit --allow-empty\n"
"\n");
static const char empty_rebase_pick_advice[] =
N_("Otherwise, please use 'git rebase --skip'\n");
@ -187,7 +187,7 @@ test_expect_success 'no changes are a nop' '
@@ -187,7 +187,7 @@ test_expect_success 'no changes are a nop' '
git checkout branch2 &&
git rebase -i F &&
test "$(git symbolic-ref -q HEAD)" = "refs/heads/branch2" &&
test $(git rev-parse I) = $(git rev-parse HEAD)
test_cmp_rev I HEAD
'
test_expect_success 'test the [branch] option' '
@ -196,16 +196,16 @@ test_expect_success 'test the [branch] option' '
@@ -196,16 +196,16 @@ test_expect_success 'test the [branch] option' '
git commit -m "stop here" &&
git rebase -i F branch2 &&
test "$(git symbolic-ref -q HEAD)" = "refs/heads/branch2" &&
test $(git rev-parse I) = $(git rev-parse branch2) &&
test $(git rev-parse I) = $(git rev-parse HEAD)
test_cmp_rev I branch2 &&
test_cmp_rev I HEAD
'
test_expect_success 'test --onto <branch>' '
git checkout -b test-onto branch2 &&
git rebase -i --onto branch1 F &&
test "$(git symbolic-ref -q HEAD)" = "refs/heads/test-onto" &&
test $(git rev-parse HEAD^) = $(git rev-parse branch1) &&
test $(git rev-parse I) = $(git rev-parse branch2)
test_cmp_rev HEAD^ branch1 &&
test_cmp_rev I branch2
'
test_expect_success 'rebase on top of a non-conflicting commit' '
@ -214,12 +214,12 @@ test_expect_success 'rebase on top of a non-conflicting commit' '
@@ -214,12 +214,12 @@ test_expect_success 'rebase on top of a non-conflicting commit' '
git rebase -i branch2 &&
test file6 = $(git diff --name-only original-branch1) &&
test "$(git symbolic-ref -q HEAD)" = "refs/heads/branch1" &&
test $(git rev-parse I) = $(git rev-parse branch2) &&
test $(git rev-parse I) = $(git rev-parse HEAD~2)
test_cmp_rev I branch2 &&
test_cmp_rev I HEAD~2
'
test_expect_success 'reflog for the branch shows state before rebase' '
test $(git rev-parse branch1@{1}) = $(git rev-parse original-branch1)
test_cmp_rev branch1@{1} original-branch1
'
test_expect_success 'reflog for the branch shows correct finish message' '
test $(git rev-parse HEAD~6) = $(git rev-parse branch1) &&
test $(git rev-parse HEAD~4^2) = $(git rev-parse to-be-preserved) &&
test $(git rev-parse HEAD^^2^) = $(git rev-parse HEAD^^^) &&
test_cmp_rev HEAD~6 branch1 &&
test_cmp_rev HEAD~4^2 to-be-preserved &&
test_cmp_rev HEAD^^2^ HEAD^^^ &&
test $(git show HEAD~5:file1) = B &&
test $(git show HEAD~3:file1) = C &&
test $(git show HEAD:file1) = E &&
@ -432,7 +432,7 @@ test_expect_success '--continue tries to commit' '
@@ -432,7 +432,7 @@ test_expect_success '--continue tries to commit' '
git add file1 &&
FAKE_COMMIT_MESSAGE="chouette!" git rebase --continue
) &&
test $(git rev-parse HEAD^) = $(git rev-parse new-branch1) &&
test_cmp_rev HEAD^ new-branch1 &&
git show HEAD | grep chouette
'
@ -739,7 +739,7 @@ test_expect_success 'do "noop" when there is nothing to cherry-pick' '
@@ -739,7 +739,7 @@ test_expect_success 'do "noop" when there is nothing to cherry-pick' '
--author="Somebody else <somebody@else.com>" &&
test $(git rev-parse branch3) != $(git rev-parse branch4) &&
git rebase -i branch3 &&
test $(git rev-parse branch3) = $(git rev-parse branch4)