public inbox for git@vger.kernel.org
 help / color / mirror / Atom feed
From: Patrick Steinhardt <ps@pks.im>
To: Lucas Seiki Oshiro <lucasseikioshiro@gmail.com>
Cc: git@vger.kernel.org, gitster@pobox.com, jltobler@gmail.com,
	avila.jn@gmail.com
Subject: Re: [PATCH 6/8] t1901: use tr in git repo structure output instead of expected value
Date: Fri, 20 Feb 2026 11:12:42 +0100	[thread overview]
Message-ID: <aZgzmlVfuXgI2UJ9@pks.im> (raw)
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 >expect_nul &&
>  		git repo structure --format=nul >out 2>err &&
> +		tr "\012" "=" <out | tr "\000" "\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" "=" <out | tr "\000" "\012" >actual &&

Same here.

Patrick

  reply	other threads:[~2026-02-20 10:12 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-18 21:08 [PATCH 0/8] repo: refactoring leftover nits Lucas Seiki Oshiro
2026-02-18 21:08 ` [PATCH 1/8] CodingGuidelines: instruct to name arrays in singular Lucas Seiki Oshiro
2026-02-19  3:29   ` Eric Sunshine
2026-02-22 21:43     ` Lucas Seiki Oshiro
2026-02-18 21:08 ` [PATCH 2/8] repo: rename repo_info_fields to repo_info_field Lucas Seiki Oshiro
2026-02-18 21:08 ` [PATCH 3/8] repo: replace get_value_fn_for_key by get_repo_info_field Lucas Seiki Oshiro
2026-02-18 21:08 ` [PATCH 4/8] repo: rename struct field to repo_info_field Lucas Seiki Oshiro
2026-02-18 21:08 ` [PATCH 5/8] t1900: rename t1900-repo to t1900-repo-info Lucas Seiki Oshiro
2026-02-18 21:08 ` [PATCH 6/8] t1901: use tr in git repo structure output instead of expected value Lucas Seiki Oshiro
2026-02-20 10:12   ` Patrick Steinhardt [this message]
2026-02-22 22:35     ` Lucas Seiki Oshiro
2026-02-18 21:08 ` [PATCH 7/8] Documentation/git-repo: replace 'NUL' with '_NUL_' Lucas Seiki Oshiro
2026-02-18 21:08 ` [PATCH 8/8] Documentation/git-repo: capitalize format descriptions Lucas Seiki Oshiro
2026-02-25 16:32 ` [PATCH v2 0/8] repo: refactoring leftover nits Lucas Seiki Oshiro
2026-02-25 16:32   ` [PATCH v2 1/8] CodingGuidelines: instruct to name arrays in singular Lucas Seiki Oshiro
2026-02-25 16:32   ` [PATCH v2 2/8] repo: rename repo_info_fields to repo_info_field Lucas Seiki Oshiro
2026-02-25 16:32   ` [PATCH v2 3/8] repo: replace get_value_fn_for_key by get_repo_info_field Lucas Seiki Oshiro
2026-02-25 16:32   ` [PATCH v2 4/8] repo: rename struct field to repo_info_field Lucas Seiki Oshiro
2026-02-25 16:32   ` [PATCH v2 5/8] t1900: rename t1900-repo to t1900-repo-info Lucas Seiki Oshiro
2026-02-25 16:32   ` [PATCH v2 6/8] t1901: adjust nul format output instead of expected value Lucas Seiki Oshiro
2026-02-25 16:32   ` [PATCH v2 7/8] Documentation/git-repo: replace 'NUL' with '_NUL_' Lucas Seiki Oshiro
2026-02-25 16:32   ` [PATCH v2 8/8] Documentation/git-repo: capitalize format descriptions Lucas Seiki Oshiro
2026-02-25 18:43   ` [PATCH v2 0/8] repo: refactoring leftover nits Lucas Seiki Oshiro
2026-02-25 19:51   ` Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=aZgzmlVfuXgI2UJ9@pks.im \
    --to=ps@pks.im \
    --cc=avila.jn@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=jltobler@gmail.com \
    --cc=lucasseikioshiro@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox