t1450: use egrep for regexp "alternation"
[gitweb.git] / t / t3404-rebase-interactive.sh
index d6d65a3a9435a456f8efad15b8c7c63db00a8e5f..3532c482fc5270675ccf6efe3a2d805d17a82466 100755 (executable)
@@ -60,9 +60,9 @@ test_expect_success 'setup' '
        test_commit P fileP
 '
 
-# "exec" commands are ran with the user shell by default, but this may
+# "exec" commands are run with the user shell by default, but this may
 # be non-POSIX. For example, if SHELL=zsh then ">file" doesn't work
-# to create a file. Unseting SHELL avoids such non-portable behavior
+# to create a file. Unsetting SHELL avoids such non-portable behavior
 # in tests. It must be exported for it to take effect where needed.
 SHELL=
 export SHELL
@@ -219,9 +219,9 @@ test_expect_success 'abort with error when new base cannot be checked out' '
        git commit -m "remove file in base" &&
        set_fake_editor &&
        test_must_fail git rebase -i master > output 2>&1 &&
-       grep "The following untracked working tree files would be overwritten by checkout:" \
+       test_i18ngrep "The following untracked working tree files would be overwritten by checkout:" \
                output &&
-       grep "file1" output &&
+       test_i18ngrep "file1" output &&
        test_path_is_missing .git/rebase-merge &&
        git reset --hard HEAD^
 '
@@ -540,7 +540,7 @@ test_expect_success 'clean error after failed "exec"' '
        echo "edited again" > file7 &&
        git add file7 &&
        test_must_fail git rebase --continue 2>error &&
-       grep "You have staged changes in your working tree." error
+       test_i18ngrep "You have staged changes in your working tree." error
 '
 
 test_expect_success 'rebase a detached HEAD' '
@@ -770,7 +770,6 @@ test_expect_success 'rebase-i history with funny messages' '
        test_cmp expect actual
 '
 
-
 test_expect_success 'prepare for rebase -i --exec' '
        git checkout master &&
        git checkout -b execute &&
@@ -779,7 +778,6 @@ test_expect_success 'prepare for rebase -i --exec' '
        test_commit three_exec main.txt three_exec
 '
 
-
 test_expect_success 'running "git rebase -i --exec git show HEAD"' '
        set_fake_editor &&
        git rebase -i --exec "git show HEAD" HEAD~2 >actual &&
@@ -792,7 +790,6 @@ test_expect_success 'running "git rebase -i --exec git show HEAD"' '
        test_cmp expected actual
 '
 
-
 test_expect_success 'running "git rebase --exec git show HEAD -i"' '
        git reset --hard execute &&
        set_fake_editor &&
@@ -806,7 +803,6 @@ test_expect_success 'running "git rebase --exec git show HEAD -i"' '
        test_cmp expected actual
 '
 
-
 test_expect_success 'running "git rebase -ix git show HEAD"' '
        git reset --hard execute &&
        set_fake_editor &&
@@ -834,7 +830,6 @@ test_expect_success 'rebase -ix with several <CMD>' '
        test_cmp expected actual
 '
 
-
 test_expect_success 'rebase -ix with several instances of --exec' '
        git reset --hard execute &&
        set_fake_editor &&
@@ -849,7 +844,6 @@ test_expect_success 'rebase -ix with several instances of --exec' '
        test_cmp expected actual
 '
 
-
 test_expect_success 'rebase -ix with --autosquash' '
        git reset --hard execute &&
        git checkout -b autosquash &&
@@ -875,16 +869,15 @@ test_expect_success 'rebase -ix with --autosquash' '
        test_cmp expected actual
 '
 
-
-test_expect_success 'rebase --exec without -i shows error message' '
+test_expect_success 'rebase --exec works without -i ' '
        git reset --hard execute &&
-       set_fake_editor &&
-       test_must_fail git rebase --exec "git show HEAD" HEAD~2 2>actual &&
-       echo "The --exec option must be used with the --interactive option" >expected &&
-       test_i18ncmp expected actual
+       rm -rf exec_output &&
+       EDITOR="echo >invoked_editor" git rebase --exec "echo a line >>exec_output"  HEAD~2 2>actual &&
+       test_i18ngrep  "Successfully rebased and updated" actual &&
+       test_line_count = 2 exec_output &&
+       test_path_is_missing invoked_editor
 '
 
-
 test_expect_success 'rebase -i --exec without <CMD>' '
        git reset --hard execute &&
        set_fake_editor &&
@@ -1067,7 +1060,7 @@ test_expect_success 'todo count' '
        EOF
        test_set_editor "$(pwd)/dump-raw.sh" &&
        git rebase -i HEAD~4 >actual &&
-       grep "^# Rebase ..* onto ..* ([0-9]" actual
+       test_i18ngrep "^# Rebase ..* onto ..* ([0-9]" actual
 '
 
 test_expect_success 'rebase -i commits that overwrite untracked files (pick)' '
@@ -1167,7 +1160,7 @@ test_expect_success 'rebase -i respects rebase.missingCommitsCheck = ignore' '
        FAKE_LINES="1 2 3 4" \
                git rebase -i --root 2>actual &&
        test D = $(git cat-file commit HEAD | sed -ne \$p) &&
-       test_cmp expect actual
+       test_i18ncmp expect actual
 '
 
 cat >expect <<EOF
@@ -1188,7 +1181,7 @@ test_expect_success 'rebase -i respects rebase.missingCommitsCheck = warn' '
        set_fake_editor &&
        FAKE_LINES="1 2 3 4" \
                git rebase -i --root 2>actual &&
-       test_cmp expect actual &&
+       test_i18ncmp expect actual &&
        test D = $(git cat-file commit HEAD | sed -ne \$p)
 '
 
@@ -1212,7 +1205,7 @@ test_expect_success 'rebase -i respects rebase.missingCommitsCheck = error' '
        set_fake_editor &&
        test_must_fail env FAKE_LINES="1 2 4" \
                git rebase -i --root 2>actual &&
-       test_cmp expect actual &&
+       test_i18ncmp expect actual &&
        cp .git/rebase-merge/git-rebase-todo.backup \
                .git/rebase-merge/git-rebase-todo &&
        FAKE_LINES="1 2 drop 3 4 drop 5" \
@@ -1235,7 +1228,7 @@ test_expect_success 'static check of bad command' '
        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 &&
+       test_i18ncmp 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) &&
@@ -1270,7 +1263,7 @@ test_expect_success 'static check of bad SHA-1' '
        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 &&
+       test_i18ncmp 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)