]> git.ipfire.org Git - thirdparty/git.git/blame - t/t3000-ls-files-others.sh
ls-files --others --directory: test
[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
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
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
20ln -s xyzzy path1
78c2cff6 21mkdir path2 path3
368f99d5 22date >path2/file2
78c2cff6
JH
23date >path2-junk
24date >path3/file3
25date >path3-junk
26git-update-index --add path3-junk path3/file3
27
28cat >expected1 <<EOF
29expected1
30expected2
908bddab 31output
368f99d5
JH
32path0
33path1
78c2cff6 34path2-junk
368f99d5
JH
35path2/file2
36EOF
78c2cff6
JH
37sed -e 's|path2/file2|path2/|' <expected1 >expected2
38
39test_expect_success \
40 'git-ls-files --others to show output.' \
41 'git-ls-files --others >output'
368f99d5
JH
42
43test_expect_success \
44 'git-ls-files --others should pick up symlinks.' \
78c2cff6
JH
45 'diff output expected1'
46
47test_expect_success \
48 'git-ls-files --others --directory to show output.' \
49 'git-ls-files --others --directory >output'
50
51
52test_expect_success \
53 'git-ls-files --others --directory should not get confused.' \
54 'diff output expected2'
55
368f99d5 56test_done