[PATCH][Bug 86451]Trailing backslash crashes ignore pattern matching

John Arbash Meinel john at arbash-meinel.com
Sat Feb 24 14:13:33 GMT 2007


Kent Gibson wrote:
> This is a knee-jerk fix for #86451, that repeats the fix of #4559 (for
> trailing '/') but for '\' - trimming any trailing '\' from the pattern.
> 
> On reflection I'm not sure this is the right approach.
> Elsewhere we normalise paths to use '/' separators.
> Should we be doing the same for ignore patterns?
> 
> Cheers,
> Kent.
> 

Ignore patterns should be normalized, or they won't work. Specifically
if you do:

bzr init
mkdir a
touch b
bzr ignore a\b

It won't ignore a/b.

There are some other small issues with what the user was trying to do.
When they did "bzr ignore a\" were they wanting "bzr ignore ./a" so that
it would ignore only 'a' in the root directory. Or were they wanting
"bzr ignore a" which would ignore it everywhere. I know there has been a
very small request for "a/" to ignore all directories named a, but not
files. At this point, I don't think it is worth spending the time to
implement that.

We've also talked about making the ignore patterns relative to the
current directory. So that if I do:

bzr init
bzr mkdir foo
cd foo
bzr ignore bar

It would actually ignore foo/bar. I'm not sure about that specific one,
because you may be wanting a recursive ignore, but most likely if you
are doing "bzr ignore ./bar" you want foo/bar.

It is tricky to figure out how to do it right, considering you can
supply patterns, etc.

So while I'm okay with your fix, I think the correct change is to
normalize the paths.

John
=:->




More information about the bazaar mailing list