Memoize gitignore filters for performance
masterWhen implementing custom filters (for example, when using cleanSourceWith), do not call gitignoreFilterWith inside the inner path-checking function. Instead, use a let binding to initialize the filter with the basePath once. This ensures that information about the git directory structure is memoized and reused across all path evaluations.
let
# CORRECT: Initialize the filter once in a let binding
srcIgnored = gitignoreFilterWith { basePath = src; extraRules = "..."; };
in
# The inner function uses the pre-initialized 'srcIgnored'
path: type: srcIgnored path type