Subject: Re: ls-files bug report

From: Kyle Meyer <[email-masked]>
Date: Wed, 05 Aug 2020 21:54:01 -0400

christian w writes:

> Sorry for the insufficient reproduction steps.
>
> I managed to figure out it has something to do with git repos within
> git repos. It happened to us because of go packages that are inside
> our repo. These are the reproduction steps that work for me
> consistently using Go version go1.14.4 darwin/amd64. This is the repo
> that gets cloned into src/golang.org/x/debug by the go get command:
> https://github.com/golang/debug/tree/66ec140f2f72d15dc6133502edd2bb7238b1740c
>
> $ mkdir testdir
> $ cd testdir
> $ git init .
> $ GOPATH=$(pwd) go get -u golang.org/x/debug/ || true
> $ git ls-files --others '*.txt'#
> src/golang.org/x/debug/

Okay, removing Go from the equation:

     $ # in fresh repo
     $ mkdir a
     $ git init a/d0
     $ touch a/f0.txt
     $ git ls-files --others 'a/*.txt'
     a/d0/
     a/f0.txt

It looks like the spurious a/d0/ entry doesn't show up until v2.27.0, in
particular 95c11ecc73 (Fix error-prone fill_directory() API; make it
only return matches, 2020-04-01).  Adding the author to the Cc.  (Sorry,
Elijah, I recall your frustration with dir.c from a previous ls-files
issue that I reported [1]).

[1] https://lore.kernel.org/git/CABPp-BFG3FkTkC=[email-masked]/