summaryrefslogtreecommitdiff
path: root/t/t7106-reset-unborn-branch.sh
diff options
context:
space:
mode:
Diffstat (limited to 't/t7106-reset-unborn-branch.sh')
-rwxr-xr-xt/t7106-reset-unborn-branch.sh34
1 files changed, 26 insertions, 8 deletions
diff --git a/t/t7106-reset-unborn-branch.sh b/t/t7106-reset-unborn-branch.sh
index 8062cf502b..0f95f00477 100755
--- a/t/t7106-reset-unborn-branch.sh
+++ b/t/t7106-reset-unborn-branch.sh
@@ -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
'