From: Junio C Hamano <gitster@pobox.com>
To: Jan Palus <jpalus@fastmail.com>
Cc: git@vger.kernel.org, Patrick Steinhardt <ps@pks.im>
Subject: Re: [PATCH v2] t8002: fix ambiguous printf conversion specifications
Date: Tue, 21 Jan 2025 14:10:14 -0800 [thread overview]
Message-ID: <xmqqplkfyg1l.fsf@gitster.g> (raw)
In-Reply-To: <20250120114106.2844157-1-jpalus@fastmail.com> (Jan Palus's message of "Mon, 20 Jan 2025 12:41:06 +0100")
Jan Palus <jpalus@fastmail.com> writes:
> - $(printf "%0.s " $(test_seq 11)) (<author@example.com> 2005-04-07 15:45:13 -0700 1) abbrev
> + $(printf "%11s" "") (<author@example.com> 2005-04-07 15:45:13 -0700 1) abbrev
This obviously is much clearer than the obscure original that
concatenates " " 11 times (for 11 arguments that printf receives).
Nice.
> @@ -146,7 +146,7 @@ test_expect_success 'blame --abbrev -b truncates the blank boundary' '
>
> test_expect_success 'blame with excessive --abbrev and -b culls to hash length' '
> cat >expect <<-EOF &&
> - $(printf "%0.s " $(test_seq $hexsz)) (<author@example.com> 2005-04-07 15:45:13 -0700 1) abbrev
> + $(printf "%${hexsz}s" "") (<author@example.com> 2005-04-07 15:45:13 -0700 1) abbrev
The fact that $hexsz was not quoted in the original made me look at
how it is defined (as an unquoted variable reference is often a way
to lose unwanted leading whitespaces, e.g. bytes=$(wc -c <foo) &&
show $bytes), but it seems that hexsz would not get any leading (or
trailing) whitespaces so this rewrite perfectly fine.
Thanks. Will queue.
prev parent reply other threads:[~2025-01-21 22:10 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-20 11:41 [PATCH v2] t8002: fix ambiguous printf conversion specifications Jan Palus
2025-01-21 22:10 ` Junio C Hamano [this message]
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=xmqqplkfyg1l.fsf@gitster.g \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--cc=jpalus@fastmail.com \
--cc=ps@pks.im \
/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;
as well as URLs for NNTP newsgroup(s).