Re: [PATCH v3 13/35] ls-refs: introduce ls-refs server command
From: Jeff King <hidden>
Date: 2018-02-24 04:03:56
On Fri, Feb 23, 2018 at 04:19:54PM -0800, Brandon Williams wrote:
quoted
We always have the ability to extend the patterns accepted via a feature (or capability) to ls-refs, so maybe the best thing to do now would only support a few patterns with specific semantics. Something like if you say "master" only match against refs/heads/ and refs/tags/ and if you want something else you would need to specify "refs/pull/master"? That way we could only support globs at the end "master*" where * can match anything (including slashes)After some in-office discussion it seems like the best thing to do for this (right now since if we change our mind we can just introduce a capability which extends the patterns supported) would be to left-anchor the ref-patterns and only allow for a single wildcard character '*' which matches zero or more characters (and doesn't care about slashes '/'). This wildcard character should only be supported at the end of the ref pattern. This means that if a client wants 'master' then they would need to specify 'refs/heads/master' (and the other ref_rev_parse_rules expansions) as a ref pattern. But they could say "refs/heads/*" for all refs under refs/heads.
Heh, I just responded without having read this and came up with the same suggestion. So I agree that is the right path. Or the simplification I mentioned that "refs/heads/master" would return that ref or possibly "refs/heads/master/foo" if it exists. Remember that it's fine to be overly broad here. This is purely an optimization in the advertisement, as we'd still pick out the refs we care about in a separate step. -Peff