Re: [PATCH v2 2/5] setup: extract path_allowlist_apply()
- From
Christian Couder <christian.couder@gmail.com>
- Date
- Sep 8, 2026, 16:46 UTC
- Message-ID
- <CAP8UFD0qSA_giG1o8ydwxUOyscQaJ9pSNyngCdC7OEa7G_C5jA@mail.gmail.com>
- In-Reply-To
- <xmqqecg0oabe.fsf@gitster.g>
On Fri, Aug 14, 2026 at 7:56 PM Junio C Hamano <gitster@pobox.com> wrote:
> > Christian Couder <christian.couder@gmail.com> writes:
Show 5 quoted lines
> > diff --git a/setup.c b/setup.c > > index 95909e9603..39dfa1cc5f 100644 > > --- a/setup.c > > +++ b/setup.c > > @@ -1339,6 +1339,64 @@ static int canonicalize_ceiling_entry(struct string_list_item *item,
[...]
Show 22 quoted lines
> > +
> > + if (ends_with(normalized, "/*")) {
> > + size_t len = strlen(normalized);
> > + if (!fspathncmp(normalized, target_path, len - 1))
> > + *is_match = 1;
> > + goto end;
> > + }
> > +
> > + if (!fspathcmp(target_path, normalized))
> > + *is_match = 1;
> > +
> > +end:
> > + free(normalized);
> > + free(allowed);
> > +}
>
> The name "is_match" somehow feels a bit awkward. How about calling
> it
>
> *matches = true/false;
>
> instead?It was `int is_match` to match with `int is_safe` in `struct safe_directory_data`, as the function is called this way:
path_allowlist_apply(key, value, data->path, &data->is_safe);
But OK, I have changed both `int is_match` and `int is_safe` to `bool matches` and `bool safe` in the v3 I just sent.
Thanks.