Updates to draft release notes to 1.6.4
[tgit.git] / t / t3000-ls-files-others.sh
blob86291e839942e6842bf1d2b40f2d7f7c1d8d4a9f
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
16 path4 - an empty directory
18 . ./test-lib.sh
20 date >path0
21 if test_have_prereq SYMLINKS
22 then
23 ln -s xyzzy path1
24 else
25 date > path1
27 mkdir path2 path3 path4
28 date >path2/file2
29 date >path2-junk
30 date >path3/file3
31 date >path3-junk
32 git update-index --add path3-junk path3/file3
34 cat >expected1 <<EOF
35 expected1
36 expected2
37 expected3
38 output
39 path0
40 path1
41 path2-junk
42 path2/file2
43 EOF
44 sed -e 's|path2/file2|path2/|' <expected1 >expected2
45 cat <expected2 >expected3
46 echo path4/ >>expected2
48 test_expect_success \
49 'git ls-files --others to show output.' \
50 'git ls-files --others >output'
52 test_expect_success \
53 'git ls-files --others should pick up symlinks.' \
54 'test_cmp expected1 output'
56 test_expect_success \
57 'git ls-files --others --directory to show output.' \
58 'git ls-files --others --directory >output'
61 test_expect_success \
62 'git ls-files --others --directory should not get confused.' \
63 'test_cmp expected2 output'
65 test_expect_success \
66 'git ls-files --others --directory --no-empty-directory to show output.' \
67 'git ls-files --others --directory --no-empty-directory >output'
69 test_expect_success \
70 '--no-empty-directory hides empty directory' \
71 'test_cmp expected3 output'
73 test_done