3 test_description='test case exclude pathspec'
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)
16 git log --oneline --format=%s >actual &&
25 test_cmp expect actual
28 test_expect_success 'exclude only pathspec uses default implicit pathspec' '
29 git log --oneline --format=%s -- . ":(exclude)sub" >expect &&
30 git log --oneline --format=%s -- ":(exclude)sub" >actual &&
31 test_cmp expect actual
34 test_expect_success 't_e_i() exclude sub' '
35 git log --oneline --format=%s -- . ":(exclude)sub" >actual &&
40 test_cmp expect actual
43 test_expect_success 't_e_i() exclude sub/sub/file' '
44 git log --oneline --format=%s -- . ":(exclude)sub/sub/file" >actual &&
52 test_cmp expect actual
55 test_expect_success 't_e_i() exclude sub using mnemonic' '
56 git log --oneline --format=%s -- . ":!sub" >actual &&
61 test_cmp expect actual
64 test_expect_success 't_e_i() exclude :(icase)SUB' '
65 git log --oneline --format=%s -- . ":(exclude,icase)SUB" >actual &&
70 test_cmp expect actual
73 test_expect_success 't_e_i() exclude sub2 from sub' '
76 git log --oneline --format=%s -- :/ ":/!sub2" >actual &&
84 test_cmp expect actual
88 test_expect_success 't_e_i() exclude sub/*file' '
89 git log --oneline --format=%s -- . ":(exclude)sub/*file" >actual &&
95 test_cmp expect actual
98 test_expect_success 't_e_i() exclude :(glob)sub/*/file' '
99 git log --oneline --format=%s -- . ":(exclude,glob)sub/*/file" >actual &&
107 test_cmp expect actual
110 test_expect_success 'm_p_d() exclude sub' '
111 git ls-files -- . ":(exclude)sub" >actual &&
116 test_cmp expect actual
119 test_expect_success 'm_p_d() exclude sub/sub/file' '
120 git ls-files -- . ":(exclude)sub/sub/file" >actual &&
128 test_cmp expect actual
131 test_expect_success 'm_p_d() exclude sub using mnemonic' '
132 git ls-files -- . ":!sub" >actual &&
137 test_cmp expect actual
140 test_expect_success 'm_p_d() exclude :(icase)SUB' '
141 git ls-files -- . ":(exclude,icase)SUB" >actual &&
146 test_cmp expect actual
149 test_expect_success 'm_p_d() exclude sub2 from sub' '
152 git ls-files -- :/ ":/!sub2" >actual &&
160 test_cmp expect actual
164 test_expect_success 'm_p_d() exclude sub/*file' '
165 git ls-files -- . ":(exclude)sub/*file" >actual &&
171 test_cmp expect actual
174 test_expect_success 'm_p_d() exclude :(glob)sub/*/file' '
175 git ls-files -- . ":(exclude,glob)sub/*/file" >actual &&
183 test_cmp expect actual
186 test_expect_success 'multiple exclusions' '
187 git ls-files -- ":^*/file2" ":^sub2" >actual &&
188 cat <<-\EOF >expect &&
194 test_cmp expect actual
197 test_expect_success 't_e_i() exclude case #8' '
203 git add file1 file2 &&
204 git commit -m twofiles &&
205 git grep -l file HEAD :^file2 >actual &&
206 echo HEAD:file1 >expected &&
207 test_cmp expected actual &&
208 git grep -l file HEAD :^file1 >actual &&
209 echo HEAD:file2 >expected &&
210 test_cmp expected actual