Merge branch 'fc/contrib-bzr-hg-fixes'
[git/gitweb.git] / t / t7106-reset-unborn-branch.sh
blobaf00ab4d88cc75ec720e31da3a0d5d3a1ef8df40
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 >expect &&
16 git ls-files >actual &&
17 test_cmp expect actual
20 test_expect_success 'reset HEAD' '
21 rm .git/index &&
22 git add a b &&
23 test_must_fail git reset HEAD
26 test_expect_success 'reset $file' '
27 rm .git/index &&
28 git add a b &&
29 git reset a &&
31 echo b >expect &&
32 git ls-files >actual &&
33 test_cmp expect actual
36 test_expect_success PERL 'reset -p' '
37 rm .git/index &&
38 git add a &&
39 echo y >yes &&
40 git reset -p <yes &&
42 >expect &&
43 git ls-files >actual &&
44 test_cmp expect actual
47 test_expect_success 'reset --soft is a no-op' '
48 rm .git/index &&
49 git add a &&
50 git reset --soft &&
52 echo a >expect &&
53 git ls-files >actual &&
54 test_cmp expect actual
57 test_expect_success 'reset --hard' '
58 rm .git/index &&
59 git add a &&
60 test_when_finished "echo a >a" &&
61 git reset --hard &&
63 >expect &&
64 git ls-files >actual &&
65 test_cmp expect actual &&
66 test_path_is_missing a
69 test_done