]>
Commit | Line | Data |
---|---|---|
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 | ||
15 | git ls-files >actual && | |
16 | test_must_be_empty actual | |
17 | ' | |
18 | ||
19 | test_expect_success 'reset HEAD' ' | |
20 | rm .git/index && | |
21 | git add a b && | |
22 | test_must_fail git reset HEAD | |
23 | ' | |
24 | ||
25 | test_expect_success 'reset $file' ' | |
26 | rm .git/index && | |
27 | git add a b && | |
28 | git reset a && | |
29 | ||
30 | echo b >expect && | |
31 | git ls-files >actual && | |
32 | test_cmp expect actual | |
33 | ' | |
34 | ||
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 && | |
40 | ||
41 | git ls-files >actual && | |
42 | test_must_be_empty actual && | |
43 | test_i18ngrep "Unstage" output | |
44 | ' | |
45 | ||
46 | test_expect_success 'reset --soft is a no-op' ' | |
47 | rm .git/index && | |
48 | git add a && | |
49 | git reset --soft && | |
50 | ||
51 | echo a >expect && | |
52 | git ls-files >actual && | |
53 | test_cmp expect actual | |
54 | ' | |
55 | ||
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 && | |
61 | ||
62 | git ls-files >actual && | |
63 | test_must_be_empty actual && | |
64 | test_path_is_missing a | |
65 | ' | |
66 | ||
67 | test_done |