Explicitly unescape hash signs. Required since Nix 2.3.
This commit is contained in:
parent
05026b6bf5
commit
206787537e
2 changed files with 24 additions and 2 deletions
|
|
@ -105,10 +105,14 @@ rec {
|
|||
in str : recurse str;
|
||||
chars = s: filter (c: c != "" && !isList c) (splitString s);
|
||||
escape = s: map (c: "\\" + c) (chars s);
|
||||
|
||||
# The "#" character normally starts a comment, but can be escaped with a
|
||||
# backslash to be a literal # in the pattern.
|
||||
unescapes = "#";
|
||||
in
|
||||
replaceStrings
|
||||
((chars special) ++ (escape escs) ++ ["**/" "**" "*" "?"])
|
||||
((escape special) ++ (escape escs) ++ ["(.*/)?" ".*" "[^/]*" "[^/]"]);
|
||||
((chars special) ++ (escape unescapes) ++ (escape escs) ++ ["**/" "**" "*" "?"])
|
||||
((escape special) ++ (chars unescapes) ++ (escape escs) ++ ["(.*/)?" ".*" "[^/]*" "[^/]"]);
|
||||
|
||||
# (regex -> regex) -> regex -> regex
|
||||
mapAroundCharclass = f: r: # rl = regex or list
|
||||
|
|
|
|||
|
|
@ -15,6 +15,8 @@ let
|
|||
create-tree() { (
|
||||
mkdir -p "$1"; cd "$1"
|
||||
|
||||
touch '#' '#ignored'
|
||||
|
||||
touches 1-simpl {1,2,3,4,5,^,$,^$,$^,[,[[,],]],]]],ab,bb,\\,\\\\,simple-test}
|
||||
touches 1-simpl/1-simpl {1,2,3,4,5,^,$,^$,$^,[,[[,],]],]]],ab,bb,\\,\\\\,simpletest}
|
||||
touches 1-xxxxx/1-simpl {1,2}
|
||||
|
|
@ -29,6 +31,13 @@ let
|
|||
|
||||
touches 5-directory {1,2,3,4,5,^,$,^$,$^,[,[[,],]],]]],ab,bb,\\,\\\\}
|
||||
|
||||
mkdir 6-hash
|
||||
touch '6-hash/a' '6-hash/a#0' '6-hash/a\#1' '6-hash/a\\#2'
|
||||
touch '6-hash/b' '6-hash/b#0' '6-hash/b\#1' '6-hash/b\\#2'
|
||||
touch '6-hash/c' '6-hash/c#0' '6-hash/c\#1' '6-hash/c\\#2'
|
||||
touch '6-hash/d' '6-hash/d#0' '6-hash/d\#1' '6-hash/d\\#2'
|
||||
touch '6-hash/z' '6-hash/z#0' '6-hash/z\#1' '6-hash/z\\#2'
|
||||
|
||||
touches 9-expected {unfiltered,filtered-via-aux-{filter,ignore,filepath}}
|
||||
|
||||
touches 10-subdir-ignoring-itself/foo {foo,bar}
|
||||
|
|
@ -73,6 +82,15 @@ let
|
|||
4-*/other.html$
|
||||
|
||||
5-*/
|
||||
|
||||
# A hash sign on a line
|
||||
#
|
||||
|
||||
6-hash/a*#
|
||||
6-hash/b*\#
|
||||
6-hash/c*\\#
|
||||
6-hash/d*\\\#
|
||||
6-hash/z*
|
||||
'';
|
||||
|
||||
ignoresAux = "/9-expected/*filepath\n";
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue