Merge branch 'rs/t4202-invert-grep-test-fix'
[git/debian.git] / t / t3002-ls-files-dashpath.sh
blob54d22a45dfbc4b7ca1080fc7bac27284fd3484f9
1 #!/bin/sh
3 # Copyright (c) 2005 Junio C Hamano
6 test_description='git ls-files test (-- to terminate the path list).
8 This test runs git ls-files --others with the following on the
9 filesystem.
11 path0 - a file
12 -foo - a file with a funny name.
13 -- - another file with a funny name.
16 TEST_PASSES_SANITIZE_LEAK=true
17 . ./test-lib.sh
19 test_expect_success \
20 setup \
21 'echo frotz >path0 &&
22 echo frotz >./-foo &&
23 echo frotz >./--'
25 test_expect_success \
26 'git ls-files without path restriction.' \
27 'git ls-files --others >output &&
28 test_cmp output - <<EOF
30 -foo
31 output
32 path0
33 EOF
36 test_expect_success \
37 'git ls-files with path restriction.' \
38 'git ls-files --others path0 >output &&
39 test_cmp output - <<EOF
40 path0
41 EOF
44 test_expect_success \
45 'git ls-files with path restriction with --.' \
46 'git ls-files --others -- path0 >output &&
47 test_cmp output - <<EOF
48 path0
49 EOF
52 test_expect_success \
53 'git ls-files with path restriction with -- --.' \
54 'git ls-files --others -- -- >output &&
55 test_cmp output - <<EOF
57 EOF
60 test_expect_success \
61 'git ls-files with no path restriction.' \
62 'git ls-files --others -- >output &&
63 test_cmp output - <<EOF
65 -foo
66 output
67 path0
68 EOF
71 test_done