##// END OF EJS Templates
match: make glob '**/' match the empty string...
Siddharth Agarwal -
r21815:a4b67bf1 stable
parent child Browse files
Show More
@@ -233,6 +233,10 def _globre(pat):
233 [^/]*
233 [^/]*
234 >>> print _globre(r'**')
234 >>> print _globre(r'**')
235 .*
235 .*
236 >>> print _globre(r'**/a')
237 (?:.*/)?a
238 >>> print _globre(r'a/**/b')
239 a\/(?:.*/)?b
236 >>> print _globre(r'[a*?!^][^b][!c]')
240 >>> print _globre(r'[a*?!^][^b][!c]')
237 [a*?!^][\^b][^c]
241 [a*?!^][\^b][^c]
238 >>> print _globre(r'{a,b}')
242 >>> print _globre(r'{a,b}')
@@ -254,6 +258,10 def _globre(pat):
254 elif c == '*':
258 elif c == '*':
255 if peek() == '*':
259 if peek() == '*':
256 i += 1
260 i += 1
261 if peek() == '/':
262 i += 1
263 res += '(?:.*/)?'
264 else:
257 res += '.*'
265 res += '.*'
258 else:
266 else:
259 res += '[^/]*'
267 res += '[^/]*'
@@ -134,3 +134,17 Check patterns that match only the direc
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
General Comments 0
You need to be logged in to leave comments. Login now