3 # Copyright (c) 2005 Junio C Hamano
6 test_description
='git ls-files --others --exclude
8 This test runs git ls-files --others and tests --exclude patterns.
14 for dir
in . one one
/two three
17 for i
in 1 2 3 4 5 6 7 8
65 !*.8' >one
/two
/.gitignore
68 'git ls-files --others with various exclude options.' \
69 'git ls-files --others \
71 --exclude-per-directory=.gitignore \
72 --exclude-from=.git/ignore \
74 test_cmp expect output'
76 # Test \r\n (MSDOS-like systems)
77 printf '*.1\r\n/*.3\r\n!*.6\r\n' >.gitignore
80 'git ls-files --others with \r\n line endings.' \
81 'git ls-files --others \
83 --exclude-per-directory=.gitignore \
84 --exclude-from=.git/ignore \
86 test_cmp expect output'
88 cat > excludes-file
<<\EOF
94 git config core.excludesFile excludes-file
96 git status |
grep "^# " > output
106 test_expect_success
'git status honors core.excludesfile' \
107 'test_cmp expect output'
109 test_expect_success
'trailing slash in exclude allows directory match(1)' '
111 git ls-files --others --exclude=one/ >output &&
112 if grep "^one/" output
122 test_expect_success
'trailing slash in exclude allows directory match (2)' '
124 git ls-files --others --exclude=one/two/ >output &&
125 if grep "^one/two/" output
135 test_expect_success
'trailing slash in exclude forces directory match (1)' '
138 git ls-files --others --exclude=two/ >output &&
143 test_expect_success
'trailing slash in exclude forces directory match (2)' '
145 git ls-files --others --exclude=one/a.1/ >output &&
146 grep "^one/a.1" output