]>
Commit | Line | Data |
---|---|---|
166ec2e9 MZ |
1 | #!/bin/sh |
2 | ||
3 | test_description='git reset should work on unborn branch' | |
4 | . ./test-lib.sh | |
5 | ||
6 | test_expect_success 'setup' ' | |
7 | echo a >a && | |
8 | echo b >b | |
9 | ' | |
10 | ||
11 | test_expect_success 'reset' ' | |
12 | git add a b && | |
13 | git reset && | |
14 | test "$(git ls-files)" = "" | |
15 | ' | |
16 | ||
17 | test_expect_success 'reset HEAD' ' | |
18 | rm .git/index && | |
19 | git add a b && | |
20 | test_must_fail git reset HEAD | |
21 | ' | |
22 | ||
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" | |
28 | ' | |
29 | ||
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)" = "" | |
35 | ' | |
36 | ||
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" | |
42 | ' | |
43 | ||
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 | |
50 | ' | |
51 | ||
52 | test_done |