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