]>
Commit | Line | Data |
---|---|---|
500b97e4 FK |
1 | #!/bin/sh |
2 | # | |
3 | # Copyright (c) 2005 Junio C Hamano | |
4 | # | |
5 | ||
5be60078 | 6 | test_description='git ls-files test (-- to terminate the path list). |
500b97e4 | 7 | |
5be60078 | 8 | This test runs git ls-files --others with the following on the |
500b97e4 FK |
9 | filesystem. |
10 | ||
11 | path0 - a file | |
12 | -foo - a file with a funny name. | |
13 | -- - another file with a funny name. | |
14 | ' | |
0b3481c9 ÆAB |
15 | |
16 | TEST_PASSES_SANITIZE_LEAK=true | |
500b97e4 FK |
17 | . ./test-lib.sh |
18 | ||
18337d40 LL |
19 | test_expect_success 'setup' ' |
20 | echo frotz >path0 && | |
500b97e4 | 21 | echo frotz >./-foo && |
18337d40 LL |
22 | echo frotz >./-- |
23 | ' | |
500b97e4 | 24 | |
18337d40 LL |
25 | test_expect_success 'git ls-files without path restriction.' ' |
26 | test_when_finished "rm -f expect" && | |
27 | git ls-files --others >output && | |
28 | cat >expect <<-\EOF && | |
29 | -- | |
30 | -foo | |
31 | output | |
32 | path0 | |
33 | EOF | |
34 | test_cmp output expect | |
500b97e4 FK |
35 | ' |
36 | ||
18337d40 LL |
37 | test_expect_success 'git ls-files with path restriction.' ' |
38 | test_when_finished "rm -f expect" && | |
39 | git ls-files --others path0 >output && | |
40 | cat >expect <<-\EOF && | |
41 | path0 | |
42 | EOF | |
43 | test_cmp output expect | |
500b97e4 FK |
44 | ' |
45 | ||
18337d40 LL |
46 | test_expect_success 'git ls-files with path restriction with --.' ' |
47 | test_when_finished "rm -f expect" && | |
48 | git ls-files --others -- path0 >output && | |
49 | cat >expect <<-\EOF && | |
50 | path0 | |
51 | EOF | |
52 | test_cmp output expect | |
500b97e4 FK |
53 | ' |
54 | ||
18337d40 LL |
55 | test_expect_success 'git ls-files with path restriction with -- --.' ' |
56 | test_when_finished "rm -f expect" && | |
57 | git ls-files --others -- -- >output && | |
58 | cat >expect <<-\EOF && | |
59 | -- | |
60 | EOF | |
61 | test_cmp output expect | |
500b97e4 FK |
62 | ' |
63 | ||
18337d40 LL |
64 | test_expect_success 'git ls-files with no path restriction.' ' |
65 | test_when_finished "rm -f expect" && | |
66 | git ls-files --others -- >output && | |
67 | cat >expect <<-\EOF && | |
68 | -- | |
69 | -foo | |
70 | output | |
71 | path0 | |
72 | EOF | |
73 | test_cmp output expect | |
74 | ||
500b97e4 FK |
75 | ' |
76 | ||
77 | test_done |