git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] Clear --exclude list after 'git rev-parse --all'

From
Junio C Hamano <gitster@pobox.com>
Date
Oct 27, 2018, 07:12 UTC
Message-ID
<xmqq5zxnc17b.fsf@gitster-ct.c.googlers.com>
In-Reply-To
<20181026074638.GA3119@sigill.intra.peff.net>
Jeff King <peff@peff.net> writes:
Show 21 quoted lines
>> I actually was hoping to see a test that contrasts "--all" (which
>> lacks the alleged "clear exclude" bug) with another option that does
>> have the "clear exclude", both used with rev-parse, i.e.
>> 
>>     $ git rev-parse --exclude='*' --glob='*' --glob='*'
>>     ... all the ref tips ...
>>     $ git rev-parse --exclude='*' --all --all
>>     ... ought to be equivalent, but is empty due to the bug ...
>> 
>> would have been a good demonstration that shows what bug we are
>> fixing d(and would have been a good test to accompany the patch.
>
> Yeah, I agree that would be fine, too. I think there are two dimensions
> in which to look at the problem, like so:
>
>          rev-list  rev-parse
>          --------  ---------
> --glob    clears    clears
> --all     clears    does not clear
>
> Testing either the row or the column (or both) works for me. :)

OK, so let's not leave this loose end untied. This may be good enough to squash in.

 builtin/rev-parse.c      |  1 -
 t/t6018-rev-list-glob.sh | 12 ++++++++++++
 2 files changed, 12 insertions(+), 1 deletion(-)
diff --git a/builtin/rev-parse.c b/builtin/rev-parse.c
index f4847d3008..a1e680b5e9 100644
--- a/builtin/rev-parse.c
+++ b/builtin/rev-parse.c
@@ -760,7 +760,6 @@ int cmd_rev_parse(int argc, const char **argv, const char *prefix)
 			}
 			if (!strcmp(arg, "--all")) {
 				for_each_ref(show_reference, NULL);
-				clear_ref_exclusion(&ref_excludes);
 				continue;
 			}
 			if (skip_prefix(arg, "--disambiguate=", &arg)) {
diff --git a/t/t6018-rev-list-glob.sh b/t/t6018-rev-list-glob.sh
index d3453c583c..b28075b65d 100755
--- a/t/t6018-rev-list-glob.sh
+++ b/t/t6018-rev-list-glob.sh
@@ -141,6 +141,18 @@ test_expect_success 'rev-parse accumulates multiple --exclude' '
 	compare rev-parse "--exclude=refs/remotes/* --exclude=refs/tags/* --all" --branches
 '
 
+test_expect_success 'rev-parse --branches clears --exclude' '
+	compare rev-parse "--exclude=* --branches --branches" "--branches"
+'
+
+test_expect_success 'rev-parse --tags clears --exclude' '
+	compare rev-parse "--exclude=* --tags --tags" "--tags"
+'
+
+test_expect_success 'rev-parse --all clears --exclude' '
+	compare rev-parse "--exclude=* --all --all" "--all"
+'
+
 test_expect_success 'rev-list --glob=refs/heads/subspace/*' '
 
 	compare rev-list "subspace/one subspace/two" "--glob=refs/heads/subspace/*"
Previous: Jeff KingNext: Jeff King
Message 9 of 10 in “Clear --exclude list after 'git rev-parse --all'”
  1. Clear --exclude list after 'git rev-parse --all'Andreas Gruenbacher, Oct 23, 2018
  2. Junio C HamanoOct 24, 2018
  3. Andreas GruenbacherOct 24, 2018
  4. Junio C HamanoOct 24, 2018
  5. Andreas GruenbacherOct 24, 2018
  6. Jeff KingOct 25, 2018
  7. Junio C HamanoOct 25, 2018
  8. Jeff KingOct 26, 2018
  9. Junio C HamanoOct 27, 2018
  10. Jeff KingOct 27, 2018

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.