Hi,
It seems git-ls-files has an issue together with certain ":(exclude)" tags.
For example, on NetworkManager's git tree (top-level directory) I run
git ls-files -- src/platform/ ":(exclude)shared/n-acd"
which wrongly lists not files. It seems to be some relation between the exclude and the search path because a different path/exclude does not exhibit the problem.
I also tested current git-master (72c4083ddf91b489b7b7b812df67ee8842177d98) which has the same issue.
Here is a reproducer (in a container run on Fedora 33/x86_64):
podman run -ti alpine:latest \
sh -c '
apk add git &&
git clone https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git &&
cd NetworkManager &&
git checkout -B tmp cd754680a6a0e35b286d4157269053ccc3996a32 &&
echo ">>>>>>now BAD1..." &&
git ls-files -- src/platform/ ":(exclude)shared/n-acd"
echo ">>>>>>now GOOD1..." &&
git ls-files -- src/platform/ ":(exclude)shared/c-list"
echo ">>>>>>now GOOD2..." &&
git ls-files -- src/platform ":(exclude)shared/n-acd"
echo ">>>>>>now GOOD3..." &&
git ls-files -- src/vpn/ ":(exclude)shared/n-acd"
'Note that only the first call in the reproducer has the unexpected result.
best, Thomas