Is it possible to use rooted glob patterns in .hgignore?
Asked Answered
P

2

13

I prefer to use glob syntax in my .hgignore files, but now I need to create a rooted pattern. I want to ignore my /static directory, but not /assets/static. The line

static/

ignores both. Is there a way to do rooted glob patterns? If not, I can switch to regex, but glob just seems so much more natural for matching pathnames.

Postbox answered 20/5, 2012 at 13:24 Comment(0)
M
10

You cannot root your glob patterns — this is documented in the manpage. You can, however, switch back and forth between the glob and regexp syntax:

syntax: glob
*.pyc

syntax: regexp
^static/

syntax: glob
*~
Mahala answered 21/5, 2012 at 9:3 Comment(0)
G
5

According to hgignore (5), it's not possible with globs:

Neither glob nor regexp patterns are rooted. A glob-syntax pattern of the form *.c will match a file ending in .c in any directory, and a regexp pattern of the form .c$ will do the same. To root a regexp pattern, start it with ^.

Groat answered 20/5, 2012 at 15:23 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.