about summary refs log tree commit diff
path: root/nixpkgs/pkgs/build-support/nix-gitignore/default.nix
diff options
context:
space:
mode:
authorAlyssa Ross <hi@alyssa.is>2021-07-23 09:26:00 +0000
committerAlyssa Ross <hi@alyssa.is>2021-07-23 09:26:00 +0000
commitab63e0bb8dcf2b1bf8d4a26ed360af777b8f241d (patch)
tree504b28a058661f6c1cbb7d3f580020e50367ca7f /nixpkgs/pkgs/build-support/nix-gitignore/default.nix
parent55cc63c079f49e81d695a25bc2f5b3902f2bd290 (diff)
parentb09661d41fb93562fd53f31574dbf781b130ac44 (diff)
downloadnixlib-ab63e0bb8dcf2b1bf8d4a26ed360af777b8f241d.tar
nixlib-ab63e0bb8dcf2b1bf8d4a26ed360af777b8f241d.tar.gz
nixlib-ab63e0bb8dcf2b1bf8d4a26ed360af777b8f241d.tar.bz2
nixlib-ab63e0bb8dcf2b1bf8d4a26ed360af777b8f241d.tar.lz
nixlib-ab63e0bb8dcf2b1bf8d4a26ed360af777b8f241d.tar.xz
nixlib-ab63e0bb8dcf2b1bf8d4a26ed360af777b8f241d.tar.zst
nixlib-ab63e0bb8dcf2b1bf8d4a26ed360af777b8f241d.zip
Merge commit 'b09661d41fb93562fd53f31574dbf781b130ac44'
Diffstat (limited to 'nixpkgs/pkgs/build-support/nix-gitignore/default.nix')
-rw-r--r--nixpkgs/pkgs/build-support/nix-gitignore/default.nix5
1 files changed, 4 insertions, 1 deletions
diff --git a/nixpkgs/pkgs/build-support/nix-gitignore/default.nix b/nixpkgs/pkgs/build-support/nix-gitignore/default.nix
index 5d7b945bf1b1..497dcb0660b0 100644
--- a/nixpkgs/pkgs/build-support/nix-gitignore/default.nix
+++ b/nixpkgs/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));