[patch] improved ignore pattern matching (#57637)
Jan Hudec
bulb at ucw.cz
Mon Nov 27 16:09:43 GMT 2006
On Mon, Nov 27, 2006 at 09:24:52PM +0800, Kent Gibson wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
>
>
> Jan Hudec wrote:
> >
> > Actually the former does not. Because the two slashes in '/**/'
> > will not match a single '/' (while it does in zsh style, because
> > there it is actually '**/', that can match empty string). For
> > extensions (the more common case), the later can be used instead.
> > But if you wanted to ignore eg. CVS dirs, under your proposal you
> > have to say: foo/CVS foo/**/CVS while under zsh style it is just:
> > foo/**/CVS
> >
> 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.
--------------------------------------------------------------------------------
- Jan Hudec `Bulb' <bulb at ucw.cz>
More information about the bazaar
mailing list