On Fri, Jul 07, 2023 at 10:23:56AM -0700, Junio C Hamano wrote: > I think in this case the common prefix optimization in "ls-files.c" > is broken. If we disable it like the attached illustration patch, > we will see that pathspecs that end with "sub" or "sub/" behave the > same way, which is what I think people would expect. Thanks, this also revealed a temporary workaround for me, just add a pathspec that ensures there's no common prefix but also matches nothing: $ git ls-files -- ':(attr:labelA)sub/sub/' 'not/a/real/path' sub/sub/fileA I might have a look into that optimization and see what changes might be made, but given I am unfamiliar with the code-base this might not be the most productive search.