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
59 !*.8' >one/two/.gitignore
62 'git ls-files --others with various exclude options.' \
63 'git ls-files --others \
65 --exclude-per-directory=.gitignore \
66 --exclude-from=.git/ignore \
68 git diff expect output'
70 # Test \r\n (MSDOS-like systems)
71 printf '*.1\r\n/*.3\r\n!*.6\r\n' >.gitignore
74 'git ls-files --others with \r\n line endings.' \
75 'git ls-files --others \
77 --exclude-per-directory=.gitignore \
78 --exclude-from=.git/ignore \
80 git diff expect output'
82 cat > excludes-file << EOF
87 git config core.excludesFile excludes-file
89 git status | grep "^# " > output
99 test_expect_success 'git-status honours core.excludesfile' \
100 'diff -u expect output'
102 test_expect_success 'trailing slash in exclude allows directory match(1)' '
104 git ls-files --others --exclude=one/ >output &&
105 if grep "^one/" output
115 test_expect_success 'trailing slash in exclude allows directory match (2)' '
117 git ls-files --others --exclude=one/two/ >output &&
118 if grep "^one/two/" output
128 test_expect_success 'trailing slash in exclude forces directory match (1)' '
131 git ls-files --others --exclude=two/ >output &&
136 test_expect_success 'trailing slash in exclude forces directory match (2)' '
138 git ls-files --others --exclude=one/a.1/ >output &&
139 grep "^one/a.1" output