use parse_commit_or_die instead of segfaulting
[alt-git.git] / t / t7106-reset-unborn-branch.sh
blob8062cf502bc473cee0d0788145f978b534246679
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 &&
14 test "$(git ls-files)" = ""
17 test_expect_success 'reset HEAD' '
18 rm .git/index &&
19 git add a b &&
20 test_must_fail git reset HEAD
23 test_expect_success 'reset $file' '
24 rm .git/index &&
25 git add a b &&
26 git reset a &&
27 test "$(git ls-files)" = "b"
30 test_expect_success 'reset -p' '
31 rm .git/index &&
32 git add a &&
33 echo y | git reset -p &&
34 test "$(git ls-files)" = ""
37 test_expect_success 'reset --soft is a no-op' '
38 rm .git/index &&
39 git add a &&
40 git reset --soft
41 test "$(git ls-files)" = "a"
44 test_expect_success 'reset --hard' '
45 rm .git/index &&
46 git add a &&
47 git reset --hard &&
48 test "$(git ls-files)" = "" &&
49 test_path_is_missing a
52 test_done