git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] t8002-blame: simplify padding generation in blank boundary tests
@ 2025-01-11 23:11 Jan Palus
  2025-01-13 12:36 ` Patrick Steinhardt
  0 siblings, 1 reply; 6+ messages in thread
From: Jan Palus @ 2025-01-11 23:11 UTC (permalink / raw)
  To: git; +Cc: Patrick Steinhardt, Jan Palus

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


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2025-01-21 20:10 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-01-11 23:11 [PATCH] t8002-blame: simplify padding generation in blank boundary tests Jan Palus
2025-01-13 12:36 ` 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

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).