Merge branch 'rt/for-each-ref-spell-tcl-as-Tcl'
[gitweb.git] / t / t7106-reset-unborn-branch.sh
index 8062cf502bc473cee0d0788145f978b534246679..0f95f004777ac3db191264fc5760c17bc1bdf77b 100755 (executable)
@@ -11,7 +11,10 @@ test_expect_success 'setup' '
 test_expect_success 'reset' '
        git add a b &&
        git reset &&
-       test "$(git ls-files)" = ""
+
+       >expect &&
+       git ls-files >actual &&
+       test_cmp expect actual
 '
 
 test_expect_success 'reset HEAD' '
@@ -24,28 +27,43 @@ test_expect_success 'reset $file' '
        rm .git/index &&
        git add a b &&
        git reset a &&
-       test "$(git ls-files)" = "b"
+
+       echo b >expect &&
+       git ls-files >actual &&
+       test_cmp expect actual
 '
 
-test_expect_success 'reset -p' '
+test_expect_success PERL 'reset -p' '
        rm .git/index &&
        git add a &&
-       echo y | git reset -p &&
-       test "$(git ls-files)" = ""
+       echo y >yes &&
+       git reset -p <yes >output &&
+
+       >expect &&
+       git ls-files >actual &&
+       test_cmp expect actual &&
+       test_i18ngrep "Unstage" output
 '
 
 test_expect_success 'reset --soft is a no-op' '
        rm .git/index &&
        git add a &&
-       git reset --soft
-       test "$(git ls-files)" = "a"
+       git reset --soft &&
+
+       echo a >expect &&
+       git ls-files >actual &&
+       test_cmp expect actual
 '
 
 test_expect_success 'reset --hard' '
        rm .git/index &&
        git add a &&
+       test_when_finished "echo a >a" &&
        git reset --hard &&
-       test "$(git ls-files)" = "" &&
+
+       >expect &&
+       git ls-files >actual &&
+       test_cmp expect actual &&
        test_path_is_missing a
 '