]> git.ipfire.org Git - thirdparty/git.git/blob - t/t3000-ls-files-others.sh
Use prerequisite tags to skip tests that depend on symbolic links
[thirdparty/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 '
17 . ./test-lib.sh
18
19 date >path0
20 if test_have_prereq SYMLINKS
21 then
22 ln -s xyzzy path1
23 else
24 date > path1
25 fi
26 mkdir path2 path3
27 date >path2/file2
28 date >path2-junk
29 date >path3/file3
30 date >path3-junk
31 git update-index --add path3-junk path3/file3
32
33 cat >expected1 <<EOF
34 expected1
35 expected2
36 output
37 path0
38 path1
39 path2-junk
40 path2/file2
41 EOF
42 sed -e 's|path2/file2|path2/|' <expected1 >expected2
43
44 test_expect_success \
45 'git ls-files --others to show output.' \
46 'git ls-files --others >output'
47
48 test_expect_success \
49 'git ls-files --others should pick up symlinks.' \
50 'test_cmp expected1 output'
51
52 test_expect_success \
53 'git ls-files --others --directory to show output.' \
54 'git ls-files --others --directory >output'
55
56
57 test_expect_success \
58 'git ls-files --others --directory should not get confused.' \
59 'test_cmp expected2 output'
60
61 test_done