[patch] improved ignore pattern matching (#57637)

Wouter van Heyst larstiq at larstiq.dyndns.org
Tue Nov 28 01:24:11 GMT 2006


On Tue, Nov 28, 2006 at 08:20:52AM +0800, Kent Gibson wrote:
> 
> 
> Jan Hudec wrote:
> >>>
> >> How about the pattern 'foo**/CVS' - it will match 'foo/CVS' and
> >> 'foo/bar/CVS', but should it match 'fooCVS'?
> >
> > Well, maybe a **/ should only be recognized at the begining of a
> > component, as it is in zsh. In zsh foo**/CVS is understood as foo*/CVS.
> >
> > The rule in my original patch was:
> >
> > _sub_shell.add(ur'(?:(?<=/)|^)\*\*(?:/|$)', ur'(?:[^./][^/]*(?:/|$))*')
> # **
> >
> > which only matches at the begining or after a slash and requires a slash
> > or end of pattern after. It would be simplified to:
> >
> > _sub_shell.add(ur'(?:(?<=/)|^)\*\*(?:/|$)', ur'(?:[^/]+(?:/|$))*') # **
> >
> > if it should not exclude the leading dot (the value is my original value
> > of *** rule).
> >
> > It is much more strict than just:
> >
> > _sub_shell.add(ur'\*\*', ur'.*')
> >
> > but the cases where ** is not separated by / on both sides are IMHO more
> > confusing than anything else. And the fact that if ** just matches
> > anything foo/**/bar does NOT match foo/bar is IMHO also confusing.
> Just to confirm, and without going into the details of the regex to
> translate it to (sorry I'm pushed for time), is it fair to say we want
> the swallowing of a trailing '/' for the case where '**' matches the
> empty string to only occur where the '**' is at the beginning of a
> component?
> For all other occurances of '**' we fall back to the "**" matches
> anything.
> i.e. foo**/CVS will match foobar/CVS but not fooCVS.
> But foo/**/CVS will match foo/CVS as well as foo/bar/CVS.

That looks sensible to me, but I better let someone more informed comment :)

Wouter van Heyst
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 307 bytes
Desc: Digital signature
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20061128/124e583d/attachment.pgp 


More information about the bazaar mailing list