nix-gitignore: fix evaluation when .gitignore contains \# or \! (#130643)
This commit is contained in:
parent
f81f715913
commit
f98bc23805
|
@ -41,6 +41,9 @@ in rec {
|
||||||
let split = match "^(!?)(.*)" l;
|
let split = match "^(!?)(.*)" l;
|
||||||
in [(elemAt split 1) (head split == "!")];
|
in [(elemAt split 1) (head split == "!")];
|
||||||
|
|
||||||
|
# regex -> regex
|
||||||
|
handleHashesBangs = replaceStrings ["\\#" "\\!"] ["#" "!"];
|
||||||
|
|
||||||
# ignore -> regex
|
# ignore -> regex
|
||||||
substWildcards =
|
substWildcards =
|
||||||
let
|
let
|
||||||
|
@ -86,7 +89,7 @@ in rec {
|
||||||
mapPat = f: l: [(f (head l)) (last l)];
|
mapPat = f: l: [(f (head l)) (last l)];
|
||||||
in
|
in
|
||||||
map (l: # `l' for "line"
|
map (l: # `l' for "line"
|
||||||
mapPat (l: handleSlashSuffix (handleSlashPrefix (mapAroundCharclass substWildcards l)))
|
mapPat (l: handleSlashSuffix (handleSlashPrefix (handleHashesBangs (mapAroundCharclass substWildcards l))))
|
||||||
(computeNegation l))
|
(computeNegation l))
|
||||||
(filter (l: !isList l && !isComment l)
|
(filter (l: !isList l && !isComment l)
|
||||||
(split "\n" gitignore));
|
(split "\n" gitignore));
|
||||||
|
|
Loading…
Reference in a new issue