[patch] improved ignore pattern matching (#57637)

Kent Gibson warthog618 at gmail.com
Mon Nov 27 05:41:24 GMT 2006


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



John Arbash Meinel wrote:
> Jan Hudec wrote:
> ...
>
>> Well, I fear that users will tend to miss that 'foo/**/bar' does not
>> match 'foo/bar' (and I think it is not SO uncommon to not want
>> 'foo/**bar instead). This can be fixed either by making the pattern
>> '**/' (like zsh does), that would expand to '(|.+/)', or to recognize
>> both '**/' and '**', translating to '(|.+/)' and '.*' respectively.
>>
You sure wouldn't want to use foo/**bar since that would also match
foo/bazbar - which isn't what you want in this case.
>
> Thanks for the clarification. So it does seem we need to understand '**/'
>
> I'm not positive that your exact translation is right. But I don't have
> time to figure it out right now.
>
I would translate '**/' to '(.*/)?'.
So 'foo/**/bar' would match 'foo/bar', 'foo/baz/bar', 'foo/.baz/bar',
'foo/baz/zoo/bar' and 'foo//bar'.
I prefer the '.*'  over '.+' cos 'foo/**/bar' will match one or more
'/' between the 'foo' and 'bar', while '.+' will match one and > 2,
but not 2 - i.e. 'foo//bar' will not match but foo///bar will.
Not terribly important since N > 1 are not valid paths, but anyway...

Jan's '(|.+/)' is equivalent to '(.+/)?' - though not a use of '|'
that I had seen before.
I find the '?' form more readable.

Does '(.*/)?' work for you guys?

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

iD8DBQFFanqEgoxTFTi1P8QRAo0vAJ4i9zupcPBwrFhGguyGQ9hRJmrptwCeIxTz
85U2uuleIvdcdiCAuKOijHs=
=Prpa
-----END PGP SIGNATURE-----




More information about the bazaar mailing list