From: Junio C Hamano <gitster@pobox.com>
To: John Cai <johncai86@gmail.com>
Cc: Taylor Blau <me@ttaylorr.com>,
John Cai via GitGitGadget <gitgitgadget@gmail.com>,
git@vger.kernel.org
Subject: Re: [PATCH 0/3] revision: refactor ref_excludes to ref_visibility
Date: Fri, 23 Jun 2023 13:57:50 -0700 [thread overview]
Message-ID: <xmqqo7l5aoc1.fsf@gitster.g> (raw)
In-Reply-To: <941CCF5B-1FE6-46BE-9ED7-77C11E943E2E@gmail.com> (John Cai's message of "Fri, 23 Jun 2023 15:16:52 -0400")
John Cai <johncai86@gmail.com> writes:
>>> After reading this description, I am not sure why you can't "include" a
>>> reference that would otherwise be excluded by passing the rules:
>>>
>>> - refs/heads/exclude/*
>>> - !refs/heads/exclude/but/include/me
>>>
>>> (where the '!' prefix in the last rule is what brings back the included
>>> reference).
>>>
>>> But let's read on and see if there is something that I'm missing.
>>
>> Having read this series in detail, I am puzzled. I don't think that
>> there is any limitation of the existing reference hiding rules that
>> wouldn't permit what you're trying to do by adding the list of
>> references you want to include at the end of the exclude list, so long
>> as they are each prefixed with the magic "!" sentinel.
>
> To be honest, I had no idea "!" would have this effect--so thanks for bringing
> it to my attention.
FWIW, "--exclude=!" gets zero hits in t/ directory.
ref_excluded() merely calls wildmatch() like so:
int ref_excluded(const struct ref_exclusions *exclusions, const char *path)
{
const char *stripped_path = strip_namespace(path);
struct string_list_item *item;
for_each_string_list_item(item, &exclusions->excluded_refs) {
if (!wildmatch(item->string, path, 0))
return 1;
}
if (ref_is_hidden(stripped_path, path, &exclusions->hidden_refs))
return 1;
return 0;
}
so I do not know what to think about it. This is called from inside
callback of things like "log --exclude=A --exclude=B ... --all" when
we are trying to add all refs in response to "--all", and it appears
to me that the first match would already determine the ref's fate
without even looking at the later patterns (prefixed with bang '!'
or not). Taylor, am I looking at a wrong code?
Puzzled...
prev parent reply other threads:[~2023-06-23 20:58 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-21 19:35 [PATCH 0/3] revision: refactor ref_excludes to ref_visibility John Cai via GitGitGadget
2023-06-21 19:35 ` [PATCH 1/3] revision: rename " John Cai via GitGitGadget
2023-06-22 12:43 ` Taylor Blau
2023-06-21 19:35 ` [PATCH 2/3] revision: add ref_visible() helper John Cai via GitGitGadget
2023-06-21 19:35 ` [PATCH 3/3] pack-refs: use new " John Cai via GitGitGadget
2023-06-21 20:56 ` [PATCH 0/3] revision: refactor ref_excludes to ref_visibility Junio C Hamano
2023-06-22 12:52 ` Taylor Blau
2023-06-22 12:42 ` Taylor Blau
2023-06-22 12:49 ` Taylor Blau
2023-06-22 12:53 ` Taylor Blau
2023-06-22 12:58 ` Taylor Blau
2023-06-23 19:16 ` John Cai
2023-06-23 20:57 ` Junio C Hamano [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=xmqqo7l5aoc1.fsf@gitster.g \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--cc=gitgitgadget@gmail.com \
--cc=johncai86@gmail.com \
--cc=me@ttaylorr.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.