Subject: Re: [PATCH v3 11/20] t: refactor tests depending on Perl substitution operator

From: Patrick Steinhardt <[email-masked]>
Date: Wed, 2 Apr 2025 09:16:23 +0200

On Tue, Apr 01, 2025 at 08:32:02PM +0200, Johannes Schindelin wrote:
> Hi Patrick,
> 
> On Thu, 27 Mar 2025, Patrick Steinhardt wrote:
> 
> > We have a bunch of tests that use Perl to perform substitution via the
> > "s/" operator. These usecases can be trivially replaced with sed(1).
> 
> ... and sometimes `tr`.
> 
> In fact, it looks like...
> 
> > diff --git a/t/t7508-status.sh b/t/t7508-status.sh
> > index 14c41b2cb7c..cdc1d6fcc78 100755
> > --- a/t/t7508-status.sh
> > +++ b/t/t7508-status.sh
> > @@ -1064,9 +1064,9 @@ test_expect_success 'status -s submodule summary (clean submodule)' '
> >  	test_cmp expect output
> >  '
> >
> > -test_expect_success PERL_TEST_HELPERS 'status -z implies porcelain' '
> > +test_expect_success 'status -z implies porcelain' '
> >  	git status --porcelain |
> > -	perl -pe "s/\012/\000/g" >expect &&
> > +	tr "\012" "\000" >expect &&
> >  	git status -z >output &&
> >  	test_cmp expect output
> >  '
> 
> ... this change is not about `sed` at all, but only about `tr`.
> _Technically_, this hunk would therefore feel more at home in the previous
> patch. But practically, I actually do not mind it being here at all.

Yeah, the boundaries between commits are fuzzy at times. I mostly wanted
to split up similar changes so that the review load is somewhat
reasonable and not have a single patch that does it all at once. And
this site here did use Perl's substitution operator, so it's not wrong
per se that we do the conversion as part of this patch. But it's of
course wrong that I only mention sed(1) in the commit message.

Patrick