Documentation/RelNotes/2.45.0.txt: fix typo
[git.git] / t / t7106-reset-unborn-branch.sh
blob88d1c8adf42eec1c219f50b9765d5b3c10d706fa
1 #!/bin/sh
3 test_description='git reset should work on unborn branch'
5 TEST_PASSES_SANITIZE_LEAK=true
6 . ./test-lib.sh
8 test_expect_success 'setup' '
9 echo a >a &&
10 echo b >b
13 test_expect_success 'reset' '
14 git add a b &&
15 git reset &&
17 git ls-files >actual &&
18 test_must_be_empty actual
21 test_expect_success 'reset HEAD' '
22 rm .git/index &&
23 git add a b &&
24 test_must_fail git reset HEAD
27 test_expect_success 'reset $file' '
28 rm .git/index &&
29 git add a b &&
30 git reset a &&
32 echo b >expect &&
33 git ls-files >actual &&
34 test_cmp expect actual
37 test_expect_success 'reset -p' '
38 rm .git/index &&
39 git add a &&
40 echo y >yes &&
41 git reset -p <yes >output &&
43 git ls-files >actual &&
44 test_must_be_empty actual &&
45 test_grep "Unstage" output
48 test_expect_success 'reset --soft is a no-op' '
49 rm .git/index &&
50 git add a &&
51 git reset --soft &&
53 echo a >expect &&
54 git ls-files >actual &&
55 test_cmp expect actual
58 test_expect_success 'reset --hard' '
59 rm .git/index &&
60 git add a &&
61 test_when_finished "echo a >a" &&
62 git reset --hard &&
64 git ls-files >actual &&
65 test_must_be_empty actual &&
66 test_path_is_missing a
69 test_done