Skip to content

Commit

Permalink
lib.cleanSourceFilter: Fix VIM swap file filtering
Browse files Browse the repository at this point in the history
The backslash wasn't properly escaped, and "\." is apparently equal to
".". So it's accidentally filtering out these valid file names (in
Nixpkgs):

trace: excluding clfswm
trace: excluding larswm
trace: excluding mkpasswd

While at it, turn the file filter stricter to what it was before
e2589b3. That is, the file name must
start with a dot: '.swp', '.foo.swo' are filtered but 'bar.swf' is not.
  • Loading branch information
dezgeg committed Sep 12, 2017
1 parent 8f566f4 commit 9275c33
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/sources.nix
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,10 @@ rec {
cleanSourceFilter = name: type: let baseName = baseNameOf (toString name); in ! (
# Filter out Subversion and CVS directories.
(type == "directory" && (baseName == ".git" || baseName == ".svn" || baseName == "CVS" || baseName == ".hg")) ||
# Filter out backup files.
# Filter out editor backup / swap files.
lib.hasSuffix "~" baseName ||
builtins.match "^.*\.sw[a-z]$" baseName != null ||
builtins.match "^\\.sw[a-z]$" baseName != null ||
builtins.match "^\\..*\\.sw[a-z]$" baseName != null ||

# Filter out generates files.
lib.hasSuffix ".o" baseName ||
Expand Down

0 comments on commit 9275c33

Please sign in to comment.