Merge branch 'da/completion-show-signature'
[git/mingw/j6t.git] / t / t6132-pathspec-exclude.sh
blob62049be0c731d9cab2a117e16deb2659f9153dd4
1 #!/bin/sh
3 test_description='test case exclude pathspec'
5 . ./test-lib.sh
7 test_expect_success 'setup' '
8 for p in file sub/file sub/sub/file sub/file2 sub/sub/sub/file sub2/file; do
9 if echo $p | grep /; then
10 mkdir -p `dirname $p`
11 fi &&
12 : >$p &&
13 git add $p &&
14 git commit -m $p
15 done &&
16 git log --oneline --format=%s >actual &&
17 cat <<EOF >expect &&
18 sub2/file
19 sub/sub/sub/file
20 sub/file2
21 sub/sub/file
22 sub/file
23 file
24 EOF
25 test_cmp expect actual
28 test_expect_success 'exclude only should error out' '
29 test_must_fail git log --oneline --format=%s -- ":(exclude)sub"
32 test_expect_success 't_e_i() exclude sub' '
33 git log --oneline --format=%s -- . ":(exclude)sub" >actual
34 cat <<EOF >expect &&
35 sub2/file
36 file
37 EOF
38 test_cmp expect actual
41 test_expect_success 't_e_i() exclude sub/sub/file' '
42 git log --oneline --format=%s -- . ":(exclude)sub/sub/file" >actual
43 cat <<EOF >expect &&
44 sub2/file
45 sub/sub/sub/file
46 sub/file2
47 sub/file
48 file
49 EOF
50 test_cmp expect actual
53 test_expect_success 't_e_i() exclude sub using mnemonic' '
54 git log --oneline --format=%s -- . ":!sub" >actual
55 cat <<EOF >expect &&
56 sub2/file
57 file
58 EOF
59 test_cmp expect actual
62 test_expect_success 't_e_i() exclude :(icase)SUB' '
63 git log --oneline --format=%s -- . ":(exclude,icase)SUB" >actual
64 cat <<EOF >expect &&
65 sub2/file
66 file
67 EOF
68 test_cmp expect actual
71 test_expect_success 't_e_i() exclude sub2 from sub' '
73 cd sub &&
74 git log --oneline --format=%s -- :/ ":/!sub2" >actual
75 cat <<EOF >expect &&
76 sub/sub/sub/file
77 sub/file2
78 sub/sub/file
79 sub/file
80 file
81 EOF
82 test_cmp expect actual
86 test_expect_success 't_e_i() exclude sub/*file' '
87 git log --oneline --format=%s -- . ":(exclude)sub/*file" >actual
88 cat <<EOF >expect &&
89 sub2/file
90 sub/file2
91 file
92 EOF
93 test_cmp expect actual
96 test_expect_success 't_e_i() exclude :(glob)sub/*/file' '
97 git log --oneline --format=%s -- . ":(exclude,glob)sub/*/file" >actual
98 cat <<EOF >expect &&
99 sub2/file
100 sub/sub/sub/file
101 sub/file2
102 sub/file
103 file
105 test_cmp expect actual
108 test_expect_success 'm_p_d() exclude sub' '
109 git ls-files -- . ":(exclude)sub" >actual
110 cat <<EOF >expect &&
111 file
112 sub2/file
114 test_cmp expect actual
117 test_expect_success 'm_p_d() exclude sub/sub/file' '
118 git ls-files -- . ":(exclude)sub/sub/file" >actual
119 cat <<EOF >expect &&
120 file
121 sub/file
122 sub/file2
123 sub/sub/sub/file
124 sub2/file
126 test_cmp expect actual
129 test_expect_success 'm_p_d() exclude sub using mnemonic' '
130 git ls-files -- . ":!sub" >actual
131 cat <<EOF >expect &&
132 file
133 sub2/file
135 test_cmp expect actual
138 test_expect_success 'm_p_d() exclude :(icase)SUB' '
139 git ls-files -- . ":(exclude,icase)SUB" >actual
140 cat <<EOF >expect &&
141 file
142 sub2/file
144 test_cmp expect actual
147 test_expect_success 'm_p_d() exclude sub2 from sub' '
149 cd sub &&
150 git ls-files -- :/ ":/!sub2" >actual
151 cat <<EOF >expect &&
152 ../file
153 file
154 file2
155 sub/file
156 sub/sub/file
158 test_cmp expect actual
162 test_expect_success 'm_p_d() exclude sub/*file' '
163 git ls-files -- . ":(exclude)sub/*file" >actual
164 cat <<EOF >expect &&
165 file
166 sub/file2
167 sub2/file
169 test_cmp expect actual
172 test_expect_success 'm_p_d() exclude :(glob)sub/*/file' '
173 git ls-files -- . ":(exclude,glob)sub/*/file" >actual
174 cat <<EOF >expect &&
175 file
176 sub/file
177 sub/file2
178 sub/sub/sub/file
179 sub2/file
181 test_cmp expect actual
184 test_done