From: Jan Palus <jpalus@fastmail.com>
To: git@vger.kernel.org
Cc: Patrick Steinhardt <ps@pks.im>, Jan Palus <jpalus@fastmail.com>
Subject: [PATCH] t8002-blame: simplify padding generation in blank boundary tests
Date: Sun, 12 Jan 2025 00:11:07 +0100 [thread overview]
Message-ID: <20250111231107.2190448-1-jpalus@fastmail.com> (raw)
Fixes compatibility with mksh as well:
$ mksh -c 'printf "%0.s" ""'
printf: %0.s: invalid conversion specification
Fixes: e7fb2ca945 ("builtin/blame: fix out-of-bounds write with blank boundary commits")
Signed-off-by: Jan Palus <jpalus@fastmail.com>
---
t/t8002-blame.sh | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/t/t8002-blame.sh b/t/t8002-blame.sh
index 1ad039e123..e98993276a 100755
--- a/t/t8002-blame.sh
+++ b/t/t8002-blame.sh
@@ -138,7 +138,7 @@ test_expect_success 'blame --abbrev -b truncates the blank boundary' '
# Note that `--abbrev=` always gets incremented by 1, which is why we
# expect 11 leading spaces and not 10.
cat >expect <<-EOF &&
- $(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
EOF
git blame -b --abbrev=10 ^HEAD -- abbrev.t >actual &&
test_cmp expect actual
@@ -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
EOF
git blame -b --abbrev=9000 ^HEAD -- abbrev.t >actual &&
test_cmp expect actual
--
2.48.0
next reply other threads:[~2025-01-11 23:11 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-11 23:11 Jan Palus [this message]
2025-01-13 12:36 ` [PATCH] t8002-blame: simplify padding generation in blank boundary tests Patrick Steinhardt
2025-01-13 15:15 ` Junio C Hamano
2025-01-18 1:09 ` Junio C Hamano
2025-01-20 10:47 ` Jan Palus
2025-01-21 20:10 ` 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=20250111231107.2190448-1-jpalus@fastmail.com \
--to=jpalus@fastmail.com \
--cc=git@vger.kernel.org \
--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).