Alternate glob matcher for .bzrignore

Harald Meland harald.meland at usit.uio.no
Mon Jan 9 15:06:12 GMT 2006


[Jan Hudec]

>> I think the '**' glob, as described in zshexpn(1), is quite hard (or
>> maybe even impossible) to properly translate into a regexp.  In
>> particular, it's hard to have it only match on directories (unless
>> bzrlib can guarantee that all candidate directories will have a
>> trailing / when passed to the glob expander).
>
> Sure it is possible. But you have to translate **/, not **! Then it is
> (if I got it correctly):
> ((?<=(^|/))([^./][^/]*/)*)
> (the empty-string case omitted, because components can't be empty.

This regexp assumes the guarantee I stated inside parentheses.  With
the following tree (where trailing / is included to signify that a
component is a directory):

  foo/
    bar
    baz/

, it is my understanding that the zsh glob pattern '**/' should
generate

  foo
  foo/baz

i.e. the pattern should not generate a result that includes the file
'foo/bar'.
-- 
Harald




More information about the bazaar mailing list