On Thu, Apr 15, 2021 at 1:51 AM Jeff King <peff@xxxxxxxx> wrote: > > On Wed, Apr 14, 2021 at 10:56:14PM +0000, brian m. carlson wrote: > > > ---- > > #!/bin/sh > > > > git init test-repo > > cd test-repo > > longname="directory" > > touch "$longname.txt" > > last=400 > > for x in $(seq 1 $last); do > > mkdir "x$longname$x" > > mv directory* "x$longname$x" > > mv "x$longname$x" "$longname$x" > > done > > git clean -ffdxn -e directory$last > > ---- > > > > When it fails, it will complain that it wasn't able to open the > > directory. It still exits zero, however. > > > > I haven't bisected this, so I don't know if those patches are related to > > the problem or not. I'm a little short on time today to investigate > > further, but hopefully this can get someone on the right path with a > > modified version and git bisect run if nothing else. > > It bisects to 8d92fb2927 (dir: replace exponential algorithm with a > linear one, 2020-04-01). I won't pretend to understand everything going > on in that commit, though. I've got a patch series to fix this and another traversal problem, and the tests pass on all platforms. Wahoo! BUT! On alpine linux-musl, I get an "error: Tests passed but test cleanup failed; aborting", which makes it report as a failed build. I'm not sure how to fix it and am asking for ideas. Apparently the deeply nested directory hierarchy cannot be removed on that platform with a simple "rm -rf $dirname". It throws a "rm: can't stat '/__w/git/git/t/trash directory.t7300-clean/avoid-traversing-deep-hierarchy/directory400/directory399/directory398/.....(you get the idea)....': Filename too long" error message.[1] Adding a "test_when_finished find directory400 -delete" also gives a "Filename too long" message followed by a lot of "Directory not empty" messages.[2] Anyone have any bright ideas about how to tweak this test? See [3] for the current incarnation of the code, which was basically taken from Brian's sample testcase. [1] https://github.com/git/git/pull/1020/checks?check_run_id=2523414561 [2] https://github.com/git/git/pull/1020/checks?check_run_id=2523594095 [3] https://github.com/git/git/pull/1020