Merge branch 'cb/uname-in-untracked'
[gitweb.git] / t / t3404-rebase-interactive.sh
index cfa741018d59678171502945e86a8f368b511d41..9d26064abaeb9134f70f3f011ac14f965a250f77 100755 (executable)
@@ -1102,6 +1102,27 @@ 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
+'
+
 rebase_setup_and_clean () {
        test_when_finished "
                git checkout master &&
@@ -1186,4 +1207,43 @@ test_expect_success 'rebase -i respects rebase.missingCommitsCheck = error' '
        test B = $(git cat-file commit HEAD^ | sed -ne \$p)
 '
 
+cat >expect <<EOF
+Warning: the command isn't recognized in the following line:
+ - badcmd $(git rev-list --oneline -1 master~1)
+
+You can fix this with 'git rebase --edit-todo'.
+Or you can abort the rebase with 'git rebase --abort'.
+EOF
+
+test_expect_success 'static check of bad command' '
+       rebase_setup_and_clean bad-cmd &&
+       set_fake_editor &&
+       test_must_fail env FAKE_LINES="1 2 3 bad 4 5" \
+               git rebase -i --root 2>actual &&
+       test_cmp expect actual &&
+       FAKE_LINES="1 2 3 drop 4 5" git rebase --edit-todo &&
+       git rebase --continue &&
+       test E = $(git cat-file commit HEAD | sed -ne \$p) &&
+       test C = $(git cat-file commit HEAD^ | sed -ne \$p)
+'
+
+cat >expect <<EOF
+Warning: the SHA-1 is missing or isn't a commit in the following line:
+ - edit XXXXXXX False commit
+
+You can fix this with 'git rebase --edit-todo'.
+Or you can abort the rebase with 'git rebase --abort'.
+EOF
+
+test_expect_success 'static check of bad SHA-1' '
+       rebase_setup_and_clean bad-sha &&
+       set_fake_editor &&
+       test_must_fail env FAKE_LINES="1 2 edit fakesha 3 4 5 #" \
+               git rebase -i --root 2>actual &&
+       test_cmp expect actual &&
+       FAKE_LINES="1 2 4 5 6" git rebase --edit-todo &&
+       git rebase --continue &&
+       test E = $(git cat-file commit HEAD | sed -ne \$p)
+'
+
 test_done