Re: [PATCH v4 13/35] ls-refs: introduce ls-refs server command
- From
- Brandon Williams <bmwill@google.com>
- Date
- Mar 5, 2018, 18:21 UTC
- Message-ID
- <20180305182155.GB72475@google.com>
- In-Reply-To
- <20180303044338.GD27689@sigill.intra.peff.net>
On 03/02, Jeff King wrote:
Show 20 quoted lines
> On Wed, Feb 28, 2018 at 03:22:30PM -0800, Brandon Williams wrote:
>
> > +static void add_pattern(struct pattern_list *patterns, const char *pattern)
> > +{
> > + struct ref_pattern p;
> > + const char *wildcard;
> > +
> > + p.pattern = strdup(pattern);
>
> xstrdup?
>
> > + wildcard = strchr(pattern, '*');
> > + if (wildcard) {
> > + p.wildcard_pos = wildcard - pattern;
> > + } else {
> > + p.wildcard_pos = -1;
> > + }
>
> Hmm, so this would accept stuff like "refs/heads/*/foo" but quietly
> ignore the "/foo" part.Yeah that's true...this should probably not do that. Since "refs/heads/*/foo" violates what the spec is, really this should error out as an invalid pattern.
Show 5 quoted lines
> > It also accepts "refs/h*" to get "refs/heads" and "refs/hello". I think > it's worth going for the most-restrictive thing to start with, since > that enables a lot more server operations without worrying about > breaking compatibility.
And just to clarify what do you see as being the most-restrictive case of patterns that would should use?
-- Brandon Williams