]>
Commit | Line | Data |
---|---|---|
0f64bfa9 CB |
1 | #!/bin/sh |
2 | ||
3 | test_description='ls-files tests with relative paths | |
4 | ||
5 | This test runs git ls-files with various relative path arguments. | |
6 | ' | |
7 | ||
8 | . ./test-lib.sh | |
9 | ||
0f64bfa9 CB |
10 | test_expect_success 'prepare' ' |
11 | : >never-mind-me && | |
12 | git add never-mind-me && | |
13 | mkdir top && | |
14 | ( | |
15 | cd top && | |
16 | mkdir sub && | |
17 | x="x xa xbc xdef xghij xklmno" && | |
18 | y=$(echo "$x" | tr x y) && | |
19 | touch $x && | |
20 | touch $y && | |
21 | cd sub && | |
22 | git add ../x* | |
23 | ) | |
24 | ' | |
25 | ||
26 | test_expect_success 'ls-files with mixed levels' ' | |
27 | ( | |
28 | cd top/sub && | |
29 | cat >expect <<-EOF && | |
30 | ../../never-mind-me | |
31 | ../x | |
32 | EOF | |
33 | git ls-files $(cat expect) >actual && | |
34 | test_cmp expect actual | |
35 | ) | |
36 | ' | |
37 | ||
38 | test_expect_success 'ls-files -c' ' | |
39 | ( | |
40 | cd top/sub && | |
efe26b9e | 41 | printf "error: pathspec $SQ%s$SQ did not match any file(s) known to git\n" ../y* >expect.err && |
bd482d6e | 42 | echo "Did you forget to ${SQ}git add${SQ}?" >>expect.err && |
385ceec1 JS |
43 | ls ../x* >expect.out && |
44 | test_must_fail git ls-files -c --error-unmatch ../[xy]* >actual.out 2>actual.err && | |
45 | test_cmp expect.out actual.out && | |
1108cea7 | 46 | test_cmp expect.err actual.err |
0f64bfa9 CB |
47 | ) |
48 | ' | |
49 | ||
50 | test_expect_success 'ls-files -o' ' | |
51 | ( | |
52 | cd top/sub && | |
efe26b9e | 53 | printf "error: pathspec $SQ%s$SQ did not match any file(s) known to git\n" ../x* >expect.err && |
bd482d6e | 54 | echo "Did you forget to ${SQ}git add${SQ}?" >>expect.err && |
385ceec1 JS |
55 | ls ../y* >expect.out && |
56 | test_must_fail git ls-files -o --error-unmatch ../[xy]* >actual.out 2>actual.err && | |
57 | test_cmp expect.out actual.out && | |
1108cea7 | 58 | test_cmp expect.err actual.err |
0f64bfa9 CB |
59 | ) |
60 | ' | |
61 | ||
62 | test_done |