Re: [PATCH v3 03/12] t/perf: add pack-objects filter and path-walk benchmark
- From
Derrick Stolee <stolee@gmail.com>
- Date
- May 13, 2026, 18:23 UTC
- Message-ID
- <b5098cab-48e7-479d-bd76-b9f17ce4a5b5@gmail.com>
- In-Reply-To
- <agJ+ORhy0O6fpJJm@nand.local>
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)
Show 19 quoted lines
>> + >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