Re: [PATCHv2 1/4] refs: add common refname_match_patterns()
- From
Michael Haggerty <mhagger@alum.mit.edu>
- Date
- Feb 13, 2012, 05:00 UTC
- Message-ID
- <4F3898F8.2000201@alum.mit.edu>
- In-Reply-To
- <20120211191748.GC4903@tgrennan-laptop>
On 02/11/2012 08:17 PM, Tom Grennan wrote:
Show 10 quoted lines
> Yes, I didn't explicitly state that the precedence is the order written > and in correctly described the first case. How about? > > /** > * Returns in highest to lowest precedence: > * 1 with an empty patterns list > * 0 if refname fnmatch()es any ^ prefaced pattern > * 1 if refname fnmatch()es any other pattern > * 0 otherwise > */
Much better; thanks.
Please note that this choice of semantics limits its power. For example, if the rule were instead (like with gitattributes(5)) "if more than one pattern matches a refname, a later pattern overrides an earlier pattern", then one could do things like
refs/remotes/*/* !refs/remotes/gitster/* refs/remotes/gitster/master
to include specific references within a hierarchy that is otherwise excluded.
However, since rev-list apparently uses a rule more like the one that you are proposing, it might be better to be consistent than to choose a different convention.
Michael
-- Michael Haggerty mhagger@alum.mit.edu http://softwareswirl.blogspot.com/