From: Patrick Steinhardt Date: Fri, 20 Feb 2026 10:12:42 GMT Subject: Re: [PATCH 6/8] t1901: use tr in git repo structure output instead of expected value Message-ID: In-Reply-To: <20260218211845.96009-7-lucasseikioshiro@gmail.com> On Wed, Feb 18, 2026 at 06:08:42PM -0300, Lucas Seiki Oshiro wrote: > The test 'keyvalue and nul format', as it description says, test both > keyvalue and nul format. These formats are similar, differing only in > their field separator (= in the former, LF in the latter) and their > record separator (LF in the former, NUL in the latter). This way, both > formats can be tested using the same expected output and only replacing > the separators in one of the output formats. Hm, okay. I have to admit I don't quite understand what we gain here. We have to use tr(1) regardless of how we do it, and I cannot see that either of these alternatives is clearly superior compared to the other. > diff --git a/t/t1901-repo-structure.sh b/t/t1901-repo-structure.sh > index a6f2591d9a..4de795181f 100755 > --- a/t/t1901-repo-structure.sh > +++ b/t/t1901-repo-structure.sh > @@ -145,18 +145,18 @@ test_expect_success SHA1 'lines and nul format' ' > test_cmp expect out && > test_line_count = 0 err && > > - # Replace key and value delimiters for nul format. > - tr "\n=" "\0\n" expect_nul && > git repo structure --format=nul >out 2>err && > + tr "\012" "=" actual && We can combine the two calls to tr(1) to a single one. > - test_cmp expect_nul out && > + test_cmp expect actual && > test_line_count = 0 err && > > # "-z", as a synonym to "--format=nul", participates in the > # usual "last one wins" rule. > git repo structure --format=table -z >out 2>err && > + tr "\012" "=" actual && Same here. Patrick