Merge branch 'en/merge-path-collision'
[git.git] / t / t7106-reset-unborn-branch.sh
blobecb85c3b823275efc68fb64643a4304a3cbf28b2
1 #!/bin/sh
3 test_description='git reset should work on unborn branch'
4 . ./test-lib.sh
6 test_expect_success 'setup' '
7 echo a >a &&
8 echo b >b
11 test_expect_success 'reset' '
12 git add a b &&
13 git reset &&
15 git ls-files >actual &&
16 test_must_be_empty actual
19 test_expect_success 'reset HEAD' '
20 rm .git/index &&
21 git add a b &&
22 test_must_fail git reset HEAD
25 test_expect_success 'reset $file' '
26 rm .git/index &&
27 git add a b &&
28 git reset a &&
30 echo b >expect &&
31 git ls-files >actual &&
32 test_cmp expect actual
35 test_expect_success PERL 'reset -p' '
36 rm .git/index &&
37 git add a &&
38 echo y >yes &&
39 git reset -p <yes >output &&
41 git ls-files >actual &&
42 test_must_be_empty actual &&
43 test_i18ngrep "Unstage" output
46 test_expect_success 'reset --soft is a no-op' '
47 rm .git/index &&
48 git add a &&
49 git reset --soft &&
51 echo a >expect &&
52 git ls-files >actual &&
53 test_cmp expect actual
56 test_expect_success 'reset --hard' '
57 rm .git/index &&
58 git add a &&
59 test_when_finished "echo a >a" &&
60 git reset --hard &&
62 git ls-files >actual &&
63 test_must_be_empty actual &&
64 test_path_is_missing a
67 test_done