Subject: Re: [PATCH v2 09/22] t/t4*: avoid redundant uses of cat

From: Junio C Hamano <[email-masked]>
Date: Fri, 15 Mar 2024 23:04:22 -0700

Taylor Blau <[email-masked]> writes:

> This and the two similar transformations below it look good to me. This
> obviously isn't the fault of your patch (nor should it necessarily be
> its aim to fix), but I wonder if it would be worthwhile to extract the
>
>     tr "\0" "\n" <out | head -n 3 | grep 3.bar | cut -f 2 -d " "
>
> pattern into a helper function, since it's used in a few places in this
> test script.

I somehow thought that the theme of the topic is to reduce the depth
of the pipeline.  "head -n 3" piped into "grep" sounds something a
single sed script can do, e.g.

	tr '\000' '\012' <out |	sed -n -e '1,3s/3.bar/&/p'

> That's just a suggestion, and shouldn't hold up this patch/series. Maybe
> just some #leftoverbits :-).

Ditto.  The whole thing can be turned into a Perl scriptlet, which
may be even easier to read (the cost to spin up one Perl interpreter
might be greater than constructing 4 process pipeline on certain
systems, though).

Thanks.

P.S. It is nice to hear from you Taylor.  It's been a while.