3
0
Fork 0
forked from mirrors/nixpkgs

lib.cleanSourceFilter: Fix VIM swap file filtering

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
e2589b3ca2. That is, the file name must
start with a dot: '.swp', '.foo.swo' are filtered but 'bar.swf' is not.
This commit is contained in:
Tuomas Tynkkynen 2017-09-12 14:50:12 +03:00
parent 8f566f4bde
commit 9275c3387e

View file

@ -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 ||