git-svn: reduce scope of input record separator change
[gitweb.git] / t / t3420-rebase-autostash.sh
index 944154b2e0ad7da5ddacdde5c22847babf1909c9..ab8a63e8d6dc643b28eb0c74ba3f032b7532226f 100755 (executable)
@@ -179,7 +179,7 @@ testrebase " --interactive" .git/rebase-merge
 
 test_expect_success 'abort rebase -i with --autostash' '
        test_when_finished "git reset --hard" &&
-       echo uncommited-content >file0 &&
+       echo uncommitted-content >file0 &&
        (
                write_script abort-editor.sh <<-\EOF &&
                        echo >"$1"
@@ -188,7 +188,38 @@ test_expect_success 'abort rebase -i with --autostash' '
                test_must_fail git rebase -i --autostash HEAD^ &&
                rm -f abort-editor.sh
        ) &&
-       echo uncommited-content >expected &&
+       echo uncommitted-content >expected &&
+       test_cmp expected file0
+'
+
+test_expect_success 'restore autostash on editor failure' '
+       test_when_finished "git reset --hard" &&
+       echo uncommitted-content >file0 &&
+       (
+               test_set_editor "false" &&
+               test_must_fail git rebase -i --autostash HEAD^
+       ) &&
+       echo uncommitted-content >expected &&
+       test_cmp expected file0
+'
+
+test_expect_success 'autostash is saved on editor failure with conflict' '
+       test_when_finished "git reset --hard" &&
+       echo uncommitted-content >file0 &&
+       (
+               write_script abort-editor.sh <<-\EOF &&
+                       echo conflicting-content >file0
+                       exit 1
+               EOF
+               test_set_editor "$(pwd)/abort-editor.sh" &&
+               test_must_fail git rebase -i --autostash HEAD^ &&
+               rm -f abort-editor.sh
+       ) &&
+       echo conflicting-content >expected &&
+       test_cmp expected file0 &&
+       git checkout file0 &&
+       git stash pop &&
+       echo uncommitted-content >expected &&
        test_cmp expected file0
 '