comparison tests/test-hgignore.t @ 21815:a4b67bf1f0a5 stable

match: make glob '**/' match the empty string Previously, a glob pattern of the form 'foo/**/bar' would match 'foo/a/bar' but not 'foo/bar'. That was because the '**' in 'foo/**/bar' would be translated to '.*', making the final regex pattern 'foo/.*/bar'. That pattern doesn't match the string 'foo/bar'. This is a bug because the '**/' glob matches the empty string in standard Unix shells like bash and zsh. Fix that by making the ending '/' optional if an empty string can be matched.
author Siddharth Agarwal <sid0@fb.com>
date Wed, 25 Jun 2014 14:50:48 -0700
parents f4930b533d55
children 7d7a4848fff4
comparison
equal deleted inserted replaced
21761:b2dc026a9bd2 21815:a4b67bf1f0a5
132 A dir/b.o 132 A dir/b.o
133 ? .hgignore 133 ? .hgignore
134 ? a.c 134 ? a.c
135 ? a.o 135 ? a.o
136 ? syntax 136 ? syntax
137
138 Check recursive glob pattern matches no directories (dir/**/c.o matches dir/c.o)
139
140 $ echo "syntax: glob" > .hgignore
141 $ echo "dir/**/c.o" >> .hgignore
142 $ touch dir/c.o
143 $ mkdir dir/subdir
144 $ touch dir/subdir/c.o
145 $ hg status
146 A dir/b.o
147 ? .hgignore
148 ? a.c
149 ? a.o
150 ? syntax