Subject: Re: [PATCH v3 03/12] t/perf: add pack-objects filter and path-walk benchmark

From: Derrick Stolee <[email-masked]>
Date: Wed, 13 May 2026 14:23:06 -0400

On 5/11/2026 9:11 PM, Taylor Blau wrote:
> On Mon, May 11, 2026 at 06:13:00PM +0000, Derrick Stolee via GitGitGadget wrote:

>> +	git ls-tree -d --name-only HEAD >top-dirs &&
>> +	top_nr=$(wc -l <top-dirs) &&

(I'll come back to this)

>> +	>depth2-dirs &&
>> +	while read tdir
>> +	do
>> +		git ls-tree -d --name-only "HEAD:$tdir" 2>/dev/null |
>> +		sed "s|^|$tdir/|" >>depth2-dirs || return 1
>> +	done <top-dirs &&
> 
> Not a huge deal, but I think we should avoid having ls-tree on the
> left-hand side of the pipe here. I would perhaps write this as:
> 
>     while read tdir
>     do
>         git ls-tree -d --name-only "HEAD:$tdir" || return 1
>     done <top-dirs >depth2-dirs.raw &&
>     sed -e "s|^|$tdir/|" depth2-dirs.raw >depth2-dirs &&
> 
> (Moving sed outside of the main loop cuts down on the process count, but
> isn't a huge deal. I think the main thing I wanted to suggest here was
> avoiding 'git ls-tree ... | sed'.)

This is a good find, because the structure of this loop is hiding
a break when a "directory" emitted by 'git ls-tree -d' is actually
a submodule entry.

I've modified the loop as well as the first ls-tree command to be
more resilient to these cases.

Thanks,
-Stolee