[bug] git-ls-files sometimes does not list files with pathspec magic ":(exclude)"
To
git@vger.kernel.org
From
Thomas Haller
Date
2021-01-13 17:41:28 UTC
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

-----BEGIN PGP SIGNATURE-----

iQIzBAABCAAdFiEESep8Zw4IUOdBlRT2KcI2bk38VygFAl//MMgACgkQKcI2bk38
VyhpfxAAm0ewT/FMFHKSjMH6VmhU0lFhBtzi7y9tRt0+y+TT7lBEszoy82dwhqVe
IigBCIrGqFXIXrhq0BsKLbW3rRLx6l791alVd5FoontswyZ51LaLWyCKj2+Ys/zl
PVWKpfW6WeO37lKSF312lnRXHtgauLvvmJdCN22iXK8TPUFfwG94y4gpIeVC8roo
r7kInGQ5oOmG06tAc2jq4Ey1WexqIECUdp6Yi9AeDW1IKmNMFNbimvq+t0HMC7qi
U34MIu57pq7p1W5oHMz0RsaqITtUEns19iQDpTwa+BhxgM0psoNhK7PPFlYstdg0
P7r8cuc+DezlEADP2TvfXSX/0I/gQBARCqrpHcu1f7PRJYZUTCB/jsSGiZHqLRp1
ooOVy5EFG8EkhuZrhOlgRMC8KKyJor/bkMyJNBar3Xad4zUcfG2fwqi/fmYteFUw
7PAtyw4rAK0sQZmqaXrA2u9aMsvRTgL9ZH0AhaNEE5HPLUGERWNgUzjEWJDbSx3d
yXyu+Y5GC5jeBGj0gciiuG/r7COtm9EpCKGTieXBu5tkt4xWNo6A3Z2jbn47dYxU
mE1JUoW7cvjGBc0JyPrue6PYhwbT0gm4SjpKhovFyqEFnpfyVFTckdGvRoS+UcgI
qI5kNv38X4c2SOgfVB6BNPYHHyUAlU5kmu3mlyLweYBethewCeQ=
=aifL
-----END PGP SIGNATURE-----