lib.cleanSourceFilter: Filter all .git, not just directories

In the case of a worktree created with `git worktree add`, .git is
actually a file with contents pointing to the original repository.
This commit is contained in:
Silvan Mosberger 2019-04-02 18:01:07 +02:00
parent 69555825f8
commit eb09fd5a88
No known key found for this signature in database
GPG key ID: 9424360B4B85C9E7

View file

@ -12,8 +12,8 @@ rec {
# Bring in a path as a source, filtering out all Subversion and CVS
# directories, as well as backup files (*~).
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 version control software files/directories
(baseName == ".git" || type == "directory" && (baseName == ".svn" || baseName == "CVS" || baseName == ".hg")) ||
# Filter out editor backup / swap files.
lib.hasSuffix "~" baseName ||
builtins.match "^\\.sw[a-z]$" baseName != null ||