[patch] improved ignore pattern matching (#57637)

John Arbash Meinel john at arbash-meinel.com
Sun Nov 26 14:35:36 GMT 2006


Kent Gibson wrote:
...

> I had hoped people would be more concerned with getting a fast and
> correct globbing fix out there than being 100% backwards compatible.
> I seem to have underestimated the importance of being bug compatible
> when fixing bugs in bzr.
> 
> Cheers,
> Kent.

In the past, we were very concerned about compatibility, which is why
Jan's patch didn't land long ago. However, we realized that the default
ignores were killing our performance on large trees, so we decided to
break compatibility.

My personal preference would be to support the following syntax:

 ? => Match any single character except '/' ie '[^/]'
 * => Match 0 or more characters except '/' ie '[^/]*'
 ** => Match 0 or more characters ie '.*'
 RE: => A prefix which lets you get as crazy as you want, except for
        group matches as mentioned by Jan.

This isn't 100% compatible with shell, but shell is trying to do
*inclusion*, while we are trying to do *exclusion*.

So when do you 'ls *', you typically don't want to see dot files. But if
you did "bzr ignore '*'" you typically *would* want to ignore dot files.

It is slightly different than other syntaxes, but having to do:

 bzr ignore 'foo/*' 'foo/.*'

So that you could make sure that all files in 'foo' default to being
ignored is ugly.

I realize some people would prefer:

 bzr ignore foo/**/*.txt

versus

 bzr ignore foo/**.txt

But both forms work in my proposed translations, and I think it is
mentally simpler to understand than the complexities of zsh globbing.

My proposed changes are:

1) Forward compatible, except for '*' not matching '/', but it has
already been decided that that was a bug, so we don't have to keep
compatibility there.

2) Simple for users to understand. And I think this is key, if you
really need complexity in your ignores, you can use RE: and go to town.
But 99.9% of the time ignore patterns are simple. They can even be
overly generic because if someone explicitly 'bzr add's a file, it
becomes versioned.

3) Handles all the common cases.

I think the proposed patch gets very close to this. And I'm sorry I
haven't spent more time looking over it. Last week was Thanksgiving here
in the US, and the week before was a conference. I'll try and look
closer on Monday.

John
=:->

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 254 bytes
Desc: OpenPGP digital signature
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20061126/625f80d7/attachment.pgp 


More information about the bazaar mailing list