[patch] improved ignore pattern matching (#57637)

Jan Hudec bulb at ucw.cz
Mon Nov 27 17:21:16 GMT 2006


On Mon, Nov 27, 2006 at 10:31:23AM -0600, John Arbash Meinel wrote:
> Kent Gibson wrote:
> > 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'?
> > 
> > Cheers,
> > Kent.
> > 
> 
> Well, it will also match 'foobar/CVS'. The way it is written, it seems
> like '**/' should match either nothing, or something that ends in a
> directory separator, which sounds like a good match for (.+/)?
> 
> I also prefer (.+/)? to (|.+/). As an aside, these should probably all
> be (?:) style, which uses a group that can't be referenced later, which
> can save processing overhead. (And the fact that the python regex engine
> has a hard limit on the number of groups it can handle per regex).

In fact it has to be (?:) style, because capturing groups are used for
other purpose in the matcher. But the ?: tends to clutter up the pattern
to a point it's unreadable (after all there IS a reason why perl6
regexps have completely different syntax).

--------------------------------------------------------------------------------
                  				- Jan Hudec `Bulb' <bulb at ucw.cz>




More information about the bazaar mailing list