Git has a shallow clone feature to only fetch one commit in the history. This helps if the repo has a heavy history, but not if the tree itself is large, as you seem to suggest. I think Microsoft is researching that with GVFS but that’s out of scope for nix-filter I’m afraid.
Personally I don’t like that include and exclude are parameters to the same function. This means that as a user, I can not decide which one is more important than the other, and perhaps worse is that I can’t see it at a glance when reading it. That’s why I’ve proposed a union-like function sources.extend in #112083. It allows you to express both choices through composition with sources.filter.
Yeah, it looks interesting. I honestly didn’t know about it until last week. Let’s try and merge both works. I think it can be useful outside of nixpkgs, and then get merged later in once the value is demonstrated.