clone_submodule: avoid using `access()` on directories
[git.git] / t / t3002-ls-files-dashpath.sh
blob4dd24550eba00ef005abea327ba1c1862768f3a1
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 'setup' '
20 echo frotz >path0 &&
21 echo frotz >./-foo &&
22 echo frotz >./--
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 &&
30 -foo
31 output
32 path0
33 EOF
34 test_cmp output expect
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
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
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 &&
60 EOF
61 test_cmp output expect
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 &&
69 -foo
70 output
71 path0
72 EOF
73 test_cmp output expect
77 test_done