]> git.ipfire.org Git - thirdparty/git.git/commitdiff
t3404-rebase-interactive: test abbreviated commands
authorJohannes Sixt <j6t@kdbg.org>
Sat, 27 Oct 2018 08:08:01 +0000 (10:08 +0200)
committerJunio C Hamano <gitster@pobox.com>
Mon, 29 Oct 2018 00:50:20 +0000 (09:50 +0900)
Make sure that each short command is tested at least once. To
not exacerbate the runtime of the test script, do not add new
tests, but modify existing ones according to these criteria:

- The test does not have a prerequisite.
- The 'git rebase' command is not guarded by test_must_fail.

The pick commands are optional in the FAKE_LINES variable, but
when used, they do end up in the insn sheet. Test them, too.

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/lib-rebase.sh
t/t3404-rebase-interactive.sh

index 2ca9fb69d62083494869fff6420eec39834b2eb4..0c93d00bddaad8a7cb6ea7ab6b966ff0c0e89fb1 100644 (file)
@@ -47,9 +47,9 @@ set_fake_editor () {
        action=pick
        for line in $FAKE_LINES; do
                case $line in
-               pick|squash|fixup|edit|reword|drop)
+               pick|p|squash|s|fixup|f|edit|e|reword|r|drop|d)
                        action="$line";;
-               exec*)
+               exec_*|x_*)
                        echo "$line" | sed 's/_/ /g' >> "$1";;
                "#")
                        echo '# comment' >> "$1";;
index 352a52e59d1a25d6fe50c5001ba3c84e2fc4a30c..d36ee4f80756c4922e139c59b815c9a496090636 100755 (executable)
@@ -114,7 +114,7 @@ test_expect_success 'rebase -i with exec allows git commands in subdirs' '
        git checkout master &&
        mkdir subdir && (cd subdir &&
        set_fake_editor &&
-       FAKE_LINES="1 exec_cd_subdir_&&_git_rev-parse_--is-inside-work-tree" \
+       FAKE_LINES="1 x_cd_subdir_&&_git_rev-parse_--is-inside-work-tree" \
                git rebase -i HEAD^
        )
 '
@@ -499,7 +499,7 @@ test_expect_success 'squash works as expected' '
        git checkout -b squash-works no-conflict-branch &&
        one=$(git rev-parse HEAD~3) &&
        set_fake_editor &&
-       FAKE_LINES="1 squash 3 2" EXPECT_HEADER_COUNT=2 \
+       FAKE_LINES="1 s 3 2" EXPECT_HEADER_COUNT=2 \
                git rebase -i HEAD~3 &&
        test $one = $(git rev-parse HEAD~2)
 '
@@ -732,7 +732,7 @@ test_expect_success 'reword' '
        git show HEAD^ | grep "D changed" &&
        FAKE_LINES="reword 1 2 3 4" FAKE_COMMIT_MESSAGE="B changed" git rebase -i A &&
        git show HEAD~3 | grep "B changed" &&
-       FAKE_LINES="1 reword 2 3 4" FAKE_COMMIT_MESSAGE="C changed" git rebase -i A &&
+       FAKE_LINES="1 r 2 pick 3 p 4" FAKE_COMMIT_MESSAGE="C changed" git rebase -i A &&
        git show HEAD~2 | grep "C changed"
 '
 
@@ -758,7 +758,7 @@ test_expect_success 'rebase -i can copy notes over a fixup' '
        git reset --hard n3 &&
        git notes add -m"an earlier note" n2 &&
        set_fake_editor &&
-       GIT_NOTES_REWRITE_MODE=concatenate FAKE_LINES="1 fixup 2" git rebase -i n1 &&
+       GIT_NOTES_REWRITE_MODE=concatenate FAKE_LINES="1 f 2" git rebase -i n1 &&
        git notes show > output &&
        test_cmp expect output
 '
@@ -1208,7 +1208,7 @@ rebase_setup_and_clean () {
 test_expect_success 'drop' '
        rebase_setup_and_clean drop-test &&
        set_fake_editor &&
-       FAKE_LINES="1 drop 2 3 drop 4 5" git rebase -i --root &&
+       FAKE_LINES="1 drop 2 3 d 4 5" git rebase -i --root &&
        test E = $(git cat-file commit HEAD | sed -ne \$p) &&
        test C = $(git cat-file commit HEAD^ | sed -ne \$p) &&
        test A = $(git cat-file commit HEAD^^ | sed -ne \$p)