Merge branch 'maint'
[git.git] / t / t3000-ls-files-others.sh
blobbc0a3513920cab41e4335b8c1b5163e25e8354d3
1 #!/bin/sh
3 # Copyright (c) 2005 Junio C Hamano
6 test_description='git ls-files test (--others should pick up symlinks).
8 This test runs git ls-files --others with the following on the
9 filesystem.
11 path0 - a file
12 path1 - a symlink
13 path2/file2 - a file in a directory
14 path3-junk - a file to confuse things
15 path3/file3 - a file in a directory
17 . ./test-lib.sh
19 date >path0
20 ln -s xyzzy path1
21 mkdir path2 path3
22 date >path2/file2
23 date >path2-junk
24 date >path3/file3
25 date >path3-junk
26 git update-index --add path3-junk path3/file3
28 cat >expected1 <<EOF
29 expected1
30 expected2
31 output
32 path0
33 path1
34 path2-junk
35 path2/file2
36 EOF
37 sed -e 's|path2/file2|path2/|' <expected1 >expected2
39 test_expect_success \
40 'git ls-files --others to show output.' \
41 'git ls-files --others >output'
43 test_expect_success \
44 'git ls-files --others should pick up symlinks.' \
45 'diff output expected1'
47 test_expect_success \
48 'git ls-files --others --directory to show output.' \
49 'git ls-files --others --directory >output'
52 test_expect_success \
53 'git ls-files --others --directory should not get confused.' \
54 'diff output expected2'
56 test_done