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
13 path2/file2 - a file in a directory
14 path3-junk - a file to confuse things
15 path3/file3 - a file in a directory
16 path4 - an empty directory
20 test_expect_success
'setup ' '
22 if test_have_prereq SYMLINKS
28 mkdir path2 path3 path4 &&
33 git update-index --add path3-junk path3/file3
36 test_expect_success
'setup: expected output' '
37 cat >expected1 <<-\EOF &&
48 sed -e "s|path2/file2|path2/|" <expected1 >expected2 &&
49 cp expected2 expected3 &&
50 echo path4/ >>expected2
53 test_expect_success
'ls-files --others' '
54 git ls-files --others >output &&
55 test_cmp expected1 output
58 test_expect_success
'ls-files --others --directory' '
59 git ls-files --others --directory >output &&
60 test_cmp expected2 output
63 test_expect_success
'--no-empty-directory hides empty directory' '
64 git ls-files --others --directory --no-empty-directory >output &&
65 test_cmp expected3 output
68 test_expect_success
'ls-files --others handles non-submodule .git' '
69 mkdir not-a-submodule &&
70 echo foo >not-a-submodule/.git &&
71 git ls-files -o >output &&
72 test_cmp expected1 output
75 test_expect_success SYMLINKS
'ls-files --others with symlinked submodule' '
87 "$SHELL_PATH" "$TEST_DIRECTORY/../contrib/workdir/git-new-workdir" ../sub sub
88 git ls-files --others --exclude-standard >../actual
91 test_cmp expect actual