Alternate glob matcher for .bzrignore

Jan Hudec bulb at ucw.cz
Mon Jan 9 18:23:30 GMT 2006


On Mon, Jan 09, 2006 at 16:06:12 +0100, Harald Meland wrote:
> [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'.

This is actual behaviour of zsh here:
bulb at efreet:/tmp/t$ echo **/*
dir dir/dir dir/dir/file dir/file file
bulb at efreet:/tmp/t$ echo **/
dir/ dir/dir/
bulb at efreet:/tmp/t$ echo **
dir file
bulb at efreet:/tmp/t$ $SHELL --version
zsh 4.3.0-dev-2 (x86_64-unknown-linux-gnu)

-- 
						 Jan 'Bulb' Hudec <bulb at ucw.cz>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20060109/f5b74c9a/attachment.pgp 


More information about the bazaar mailing list