diff options
author | Guillaume Girol <symphorien@users.noreply.github.com> | 2021-07-22 16:18:10 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-07-22 12:18:10 -0400 |
commit | f98bc23805c5956314f0c0359794225a2557088f (patch) | |
tree | 31b48f7d84632f3743639687de08c874b27c7e02 /pkgs/build-support | |
parent | f81f71591399b64ffe0c7002042078bd0a7b2192 (diff) | |
download | nixpkgs-f98bc23805c5956314f0c0359794225a2557088f.tar nixpkgs-f98bc23805c5956314f0c0359794225a2557088f.tar.gz nixpkgs-f98bc23805c5956314f0c0359794225a2557088f.tar.bz2 nixpkgs-f98bc23805c5956314f0c0359794225a2557088f.tar.lz nixpkgs-f98bc23805c5956314f0c0359794225a2557088f.tar.xz nixpkgs-f98bc23805c5956314f0c0359794225a2557088f.tar.zst nixpkgs-f98bc23805c5956314f0c0359794225a2557088f.zip |
nix-gitignore: fix evaluation when .gitignore contains \# or \! (#130643)
Diffstat (limited to 'pkgs/build-support')
-rw-r--r-- | pkgs/build-support/nix-gitignore/default.nix | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/pkgs/build-support/nix-gitignore/default.nix b/pkgs/build-support/nix-gitignore/default.nix index 5d7b945bf1b..497dcb0660b 100644 --- a/pkgs/build-support/nix-gitignore/default.nix +++ b/pkgs/build-support/nix-gitignore/default.nix @@ -41,6 +41,9 @@ in rec { let split = match "^(!?)(.*)" l; in [(elemAt split 1) (head split == "!")]; + # regex -> regex + handleHashesBangs = replaceStrings ["\\#" "\\!"] ["#" "!"]; + # ignore -> regex substWildcards = let @@ -86,7 +89,7 @@ in rec { mapPat = f: l: [(f (head l)) (last l)]; in map (l: # `l' for "line" - mapPat (l: handleSlashSuffix (handleSlashPrefix (mapAroundCharclass substWildcards l))) + mapPat (l: handleSlashSuffix (handleSlashPrefix (handleHashesBangs (mapAroundCharclass substWildcards l)))) (computeNegation l)) (filter (l: !isList l && !isComment l) (split "\n" gitignore)); |