]> git.ipfire.org Git - thirdparty/git.git/blame - 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
CommitLineData
368f99d5
JH
1#!/bin/sh
2#
3# Copyright (c) 2005 Junio C Hamano
4#
5
5be60078 6test_description='git ls-files test (--others should pick up symlinks).
368f99d5 7
5be60078 8This test runs git ls-files --others with the following on the
368f99d5
JH
9filesystem.
10
11 path0 - a file
12 path1 - a symlink
13 path2/file2 - a file in a directory
78c2cff6
JH
14 path3-junk - a file to confuse things
15 path3/file3 - a file in a directory
368f99d5
JH
16'
17. ./test-lib.sh
18
19date >path0
704a3143
JS
20if test_have_prereq SYMLINKS
21then
22 ln -s xyzzy path1
23else
24 date > path1
25fi
78c2cff6 26mkdir path2 path3
368f99d5 27date >path2/file2
78c2cff6
JH
28date >path2-junk
29date >path3/file3
30date >path3-junk
5be60078 31git update-index --add path3-junk path3/file3
78c2cff6
JH
32
33cat >expected1 <<EOF
34expected1
35expected2
908bddab 36output
368f99d5
JH
37path0
38path1
78c2cff6 39path2-junk
368f99d5
JH
40path2/file2
41EOF
78c2cff6
JH
42sed -e 's|path2/file2|path2/|' <expected1 >expected2
43
44test_expect_success \
5be60078
JH
45 'git ls-files --others to show output.' \
46 'git ls-files --others >output'
368f99d5
JH
47
48test_expect_success \
5be60078 49 'git ls-files --others should pick up symlinks.' \
188c3827 50 'test_cmp expected1 output'
78c2cff6
JH
51
52test_expect_success \
5be60078
JH
53 'git ls-files --others --directory to show output.' \
54 'git ls-files --others --directory >output'
78c2cff6
JH
55
56
57test_expect_success \
5be60078 58 'git ls-files --others --directory should not get confused.' \
188c3827 59 'test_cmp expected2 output'
78c2cff6 60
368f99d5 61test_done