Teach "git diff" to handle filenames starting with '-'
[debian-git.git] / t / t3002-ls-files-dashpath.sh
blobb42f1382bc9c585d12febcd99594f6ba7d7d743c
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.
15 . ./test-lib.sh
17 test_expect_success \
18 setup \
19 'echo frotz >path0 &&
20 echo frotz >./-foo &&
21 echo frotz >./--'
23 test_expect_success \
24 'git-ls-files without path restriction.' \
25 'git-ls-files --others >output &&
26 diff -u output - <<EOF
28 -foo
29 output
30 path0
31 EOF
34 test_expect_success \
35 'git-ls-files with path restriction.' \
36 'git-ls-files --others path0 >output &&
37 diff -u output - <<EOF
38 path0
39 EOF
42 test_expect_success \
43 'git-ls-files with path restriction with --.' \
44 'git-ls-files --others -- path0 >output &&
45 diff -u output - <<EOF
46 path0
47 EOF
50 test_expect_success \
51 'git-ls-files with path restriction with -- --.' \
52 'git-ls-files --others -- -- >output &&
53 diff -u output - <<EOF
55 EOF
58 test_expect_success \
59 'git-ls-files with no path restriction.' \
60 'git-ls-files --others -- >output &&
61 diff -u output - <<EOF
63 -foo
64 output
65 path0
66 EOF
69 test_done