Merge branch 'master' of git://repo.or.cz/alt-git
[git/mingw.git] / t / t3000-ls-files-others.sh
blobb09f583cb117220e561198f85810237091b0167b
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 ln -s xyzzy path1
22 test "$no_symlinks" && date > path1
23 mkdir path2 path3 path4
24 date >path2/file2
25 date >path2-junk
26 date >path3/file3
27 date >path3-junk
28 git update-index --add path3-junk path3/file3
30 cat >expected1 <<EOF
31 expected1
32 expected2
33 expected3
34 output
35 path0
36 path1
37 path2-junk
38 path2/file2
39 EOF
40 sed -e 's|path2/file2|path2/|' <expected1 >expected2
41 cat <expected2 >expected3
42 echo path4/ >>expected2
44 test_expect_success \
45 'git ls-files --others to show output.' \
46 'git ls-files --others >output'
48 test_expect_success \
49 'git ls-files --others should pick up symlinks.' \
50 'test_cmp expected1 output'
52 test_expect_success \
53 'git ls-files --others --directory to show output.' \
54 'git ls-files --others --directory >output'
57 test_expect_success \
58 'git ls-files --others --directory should not get confused.' \
59 'test_cmp expected2 output'
61 test_expect_success \
62 'git ls-files --others --directory --no-empty-directory to show output.' \
63 'git ls-files --others --directory --no-empty-directory >output'
65 test_expect_success \
66 '--no-empty-directory hides empty directory' \
67 'test_cmp expected3 output'
69 test_done