1#!/bin/sh
2#
3# Copyright (c) 2005 Junio C Hamano
4#
5
6test_description='git ls-files test (--others should pick up symlinks).
7
8This test runs git ls-files --others with the following on the
9filesystem.
10
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
17'
18. ./test-lib.sh
19
20date >path0
21ln -s xyzzy path1
22mkdir path2 path3 path4
23date >path2/file2
24date >path2-junk
25date >path3/file3
26date >path3-junk
27git update-index --add path3-junk path3/file3
28
29cat >expected1 <<EOF
30expected1
31expected2
32expected3
33output
34path0
35path1
36path2-junk
37path2/file2
38EOF
39sed -e 's|path2/file2|path2/|' <expected1 >expected2
40cat <expected2 >expected3
41echo path4/ >>expected2
42
43test_expect_success \
44 'git ls-files --others to show output.' \
45 'git ls-files --others >output'
46
47test_expect_success \
48 'git ls-files --others should pick up symlinks.' \
49 'test_cmp expected1 output'
50
51test_expect_success \
52 'git ls-files --others --directory to show output.' \
53 'git ls-files --others --directory >output'
54
55
56test_expect_success \
57 'git ls-files --others --directory should not get confused.' \
58 'test_cmp expected2 output'
59
60test_expect_success \
61 'git ls-files --others --directory --no-empty-directory to show output.' \
62 'git ls-files --others --directory --no-empty-directory >output'
63
64test_expect_success \
65 '--no-empty-directory hides empty directory' \
66 'test_cmp expected3 output'
67
68test_done