Skip to content

Commit 9d55dca

Browse files
rafascgitster
authored andcommitted
refs: show --exclude failure with --branches/tags/remotes=glob
The documentation of `--exclude=` option from rev-list and rev-parse explicitly states that exclude patterns *should not* start with 'refs/' when used with `--branches`, `--tags` or `--remotes`. However, following this advice results in refereces not being excluded if the next `--branches`, `--tags`, `--remotes` use the optional inclusive glob. Demonstrate this failure. Signed-off-by: Rafael Ascensão <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent cae598d commit 9d55dca

File tree

1 file changed

+57
-3
lines changed

1 file changed

+57
-3
lines changed

t/t6018-rev-list-glob.sh

Lines changed: 57 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,13 @@ test_expect_success 'setup' '
3636
git tag foo/bar master &&
3737
commit master3 &&
3838
git update-ref refs/remotes/foo/baz master &&
39-
commit master4
39+
commit master4 &&
40+
git update-ref refs/remotes/upstream/one subspace/one &&
41+
git update-ref refs/remotes/upstream/two subspace/two &&
42+
git update-ref refs/remotes/upstream/x subspace-x &&
43+
git tag qux/one subspace/one &&
44+
git tag qux/two subspace/two &&
45+
git tag qux/x subspace-x
4046
'
4147

4248
test_expect_success 'rev-parse --glob=refs/heads/subspace/*' '
@@ -141,6 +147,54 @@ test_expect_success 'rev-parse accumulates multiple --exclude' '
141147
compare rev-parse "--exclude=refs/remotes/* --exclude=refs/tags/* --all" --branches
142148
'
143149

150+
test_expect_failure 'rev-parse --exclude=glob with --branches=glob' '
151+
compare rev-parse "--exclude=subspace-* --branches=sub*" "subspace/one subspace/two"
152+
'
153+
154+
test_expect_failure 'rev-parse --exclude=glob with --tags=glob' '
155+
compare rev-parse "--exclude=qux/? --tags=qux/*" "qux/one qux/two"
156+
'
157+
158+
test_expect_failure 'rev-parse --exclude=glob with --remotes=glob' '
159+
compare rev-parse "--exclude=upstream/? --remotes=upstream/*" "upstream/one upstream/two"
160+
'
161+
162+
test_expect_failure 'rev-parse --exclude=ref with --branches=glob' '
163+
compare rev-parse "--exclude=subspace-x --branches=sub*" "subspace/one subspace/two"
164+
'
165+
166+
test_expect_failure 'rev-parse --exclude=ref with --tags=glob' '
167+
compare rev-parse "--exclude=qux/x --tags=qux/*" "qux/one qux/two"
168+
'
169+
170+
test_expect_failure 'rev-parse --exclude=ref with --remotes=glob' '
171+
compare rev-parse "--exclude=upstream/x --remotes=upstream/*" "upstream/one upstream/two"
172+
'
173+
174+
test_expect_failure 'rev-list --exclude=glob with --branches=glob' '
175+
compare rev-list "--exclude=subspace-* --branches=sub*" "subspace/one subspace/two"
176+
'
177+
178+
test_expect_failure 'rev-list --exclude=glob with --tags=glob' '
179+
compare rev-list "--exclude=qux/? --tags=qux/*" "qux/one qux/two"
180+
'
181+
182+
test_expect_failure 'rev-list --exclude=glob with --remotes=glob' '
183+
compare rev-list "--exclude=upstream/? --remotes=upstream/*" "upstream/one upstream/two"
184+
'
185+
186+
test_expect_failure 'rev-list --exclude=ref with --branches=glob' '
187+
compare rev-list "--exclude=subspace-x --branches=sub*" "subspace/one subspace/two"
188+
'
189+
190+
test_expect_failure 'rev-list --exclude=ref with --tags=glob' '
191+
compare rev-list "--exclude=qux/x --tags=qux/*" "qux/one qux/two"
192+
'
193+
194+
test_expect_failure 'rev-list --exclude=ref with --remotes=glob' '
195+
compare rev-list "--exclude=upstream/x --remotes=upstream/*" "upstream/one upstream/two"
196+
'
197+
144198
test_expect_success 'rev-list --glob=refs/heads/subspace/*' '
145199
146200
compare rev-list "subspace/one subspace/two" "--glob=refs/heads/subspace/*"
@@ -233,7 +287,7 @@ test_expect_success 'rev-list --tags=foo' '
233287

234288
test_expect_success 'rev-list --tags' '
235289
236-
compare rev-list "foo/bar" "--tags"
290+
compare rev-list "foo/bar qux/x qux/two qux/one" "--tags"
237291
238292
'
239293

@@ -292,7 +346,7 @@ test_expect_success 'shortlog accepts --glob/--tags/--remotes' '
292346
"master other/three someref subspace-x subspace/one subspace/two" \
293347
"--glob=heads/*" &&
294348
compare shortlog foo/bar --tags=foo &&
295-
compare shortlog foo/bar --tags &&
349+
compare shortlog "foo/bar qux/one qux/two qux/x" --tags &&
296350
compare shortlog foo/baz --remotes=foo
297351
298352
'

0 commit comments

Comments
 (0)