[patch] improved ignore pattern matching (#57637)

Kent Gibson warthog618 at gmail.com
Tue Nov 28 00:20:52 GMT 2006


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1



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.


Cheers,
Kent.

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.3 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFFa4DjgoxTFTi1P8QRAgkqAKCJVY1AqKEAzwLATgcEsQAngZ0L+QCeJO+e
AZ5N86E34RcSWIoYvAVj4LM=
=b6sA
-----END PGP SIGNATURE-----




More information about the bazaar mailing list