git-ls-files: --exclude mechanism updates.
[git.git] / t / t3001-ls-files-others-exclude.sh
1 #!/bin/sh
2 #
3 # Copyright (c) 2005 Junio C Hamano
4 #
5
6 test_description='git-ls-files --others --exclude
7
8 This test runs git-ls-files --others and tests --exclude patterns.
9 '
10
11 . ./test-lib.sh
12
13 rm -fr one three
14 for dir in . one one/two three
15 do
16   mkdir -p $dir &&
17   for i in 1 2 3 4 5
18   do
19     >$dir/a.$i
20   done
21 done
22
23 cat >expect <<EOF
24 a.2
25 a.4
26 a.5
27 one/a.3
28 one/a.4
29 one/a.5
30 one/two/a.3
31 one/two/a.5
32 three/a.2
33 three/a.3
34 three/a.4
35 three/a.5
36 EOF
37
38 echo '.gitignore
39 output
40 expect
41 .gitignore
42 ' >.git/ignore
43
44 echo '*.1
45 /*.3' >.gitignore
46 echo '*.2
47 two/*.4' >one/.gitignore
48
49 test_expect_success \
50     'git-ls-files --others --exclude.' \
51     'git-ls-files --others \
52        --exclude-per-directory=.gitignore \
53        --exclude-from=.git/ignore \
54        >output &&
55      diff -u expect output'