]>
Commit | Line | Data |
---|---|---|
f87f9497 JH |
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 && | |
1df092d2 | 17 | for i in 1 2 3 4 5 6 7 8 |
f87f9497 JH |
18 | do |
19 | >$dir/a.$i | |
20 | done | |
21 | done | |
22 | ||
23 | cat >expect <<EOF | |
24 | a.2 | |
25 | a.4 | |
26 | a.5 | |
1df092d2 | 27 | a.8 |
f87f9497 JH |
28 | one/a.3 |
29 | one/a.4 | |
30 | one/a.5 | |
1df092d2 JH |
31 | one/a.7 |
32 | one/two/a.2 | |
f87f9497 JH |
33 | one/two/a.3 |
34 | one/two/a.5 | |
1df092d2 JH |
35 | one/two/a.7 |
36 | one/two/a.8 | |
f87f9497 JH |
37 | three/a.2 |
38 | three/a.3 | |
39 | three/a.4 | |
40 | three/a.5 | |
1df092d2 | 41 | three/a.8 |
f87f9497 JH |
42 | EOF |
43 | ||
44 | echo '.gitignore | |
45 | output | |
46 | expect | |
47 | .gitignore | |
1df092d2 JH |
48 | *.7 |
49 | !*.8' >.git/ignore | |
f87f9497 JH |
50 | |
51 | echo '*.1 | |
1df092d2 JH |
52 | /*.3 |
53 | !*.6' >.gitignore | |
f87f9497 | 54 | echo '*.2 |
1df092d2 JH |
55 | two/*.4 |
56 | !*.7 | |
57 | *.8' >one/.gitignore | |
58 | echo '!*.2 | |
59 | !*.8' >one/two/.gitignore | |
f87f9497 JH |
60 | |
61 | test_expect_success \ | |
1df092d2 | 62 | 'git-ls-files --others with various exclude options.' \ |
f87f9497 | 63 | 'git-ls-files --others \ |
1df092d2 | 64 | --exclude=\*.6 \ |
f87f9497 JH |
65 | --exclude-per-directory=.gitignore \ |
66 | --exclude-from=.git/ignore \ | |
67 | >output && | |
68 | diff -u expect output' | |
da7bc9b0 | 69 | |
d317e438 AR |
70 | # Test \r\n (MSDOS-like systems) |
71 | echo -ne '*.1\r\n/*.3\r\n!*.6\r\n' >.gitignore | |
72 | ||
73 | test_expect_success \ | |
74 | 'git-ls-files --others with \r\n line endings.' \ | |
75 | 'git-ls-files --others \ | |
76 | --exclude=\*.6 \ | |
77 | --exclude-per-directory=.gitignore \ | |
78 | --exclude-from=.git/ignore \ | |
79 | >output && | |
80 | diff -u expect output' | |
81 | ||
da7bc9b0 | 82 | test_done |