|
| 1 | +From 17e4160cac5807e55057d88c4d53850c2a660ec6 Mon Sep 17 00:00:00 2001 |
| 2 | +From: Jan Palus <jpalus@fastmail.com> |
| 3 | +Date: Sat, 11 Jan 2025 23:11:12 +0100 |
| 4 | +Subject: [PATCH] t8002-blame: simplify padding generation in blank boundary |
| 5 | + tests |
| 6 | + |
| 7 | +Fixes compatibility with mksh as well: |
| 8 | +$ mksh -c 'printf "%0.s" ""' |
| 9 | +printf: %0.s: invalid conversion specification |
| 10 | + |
| 11 | +Fixes: e7fb2ca945 ("builtin/blame: fix out-of-bounds write with blank boundary commits") |
| 12 | +--- |
| 13 | + t/t8002-blame.sh | 4 ++-- |
| 14 | + 1 file changed, 2 insertions(+), 2 deletions(-) |
| 15 | + |
| 16 | +diff --git a/t/t8002-blame.sh b/t/t8002-blame.sh |
| 17 | +index 1ad039e123..e98993276a 100755 |
| 18 | +--- a/t/t8002-blame.sh |
| 19 | ++++ b/t/t8002-blame.sh |
| 20 | +@@ -138,7 +138,7 @@ test_expect_success 'blame --abbrev -b truncates the blank boundary' ' |
| 21 | + # Note that `--abbrev=` always gets incremented by 1, which is why we |
| 22 | + # expect 11 leading spaces and not 10. |
| 23 | + cat >expect <<-EOF && |
| 24 | +- $(printf "%0.s " $(test_seq 11)) (<author@example.com> 2005-04-07 15:45:13 -0700 1) abbrev |
| 25 | ++ $(printf "%11s" "") (<author@example.com> 2005-04-07 15:45:13 -0700 1) abbrev |
| 26 | + EOF |
| 27 | + git blame -b --abbrev=10 ^HEAD -- abbrev.t >actual && |
| 28 | + test_cmp expect actual |
| 29 | +@@ -146,7 +146,7 @@ test_expect_success 'blame --abbrev -b truncates the blank boundary' ' |
| 30 | + |
| 31 | + test_expect_success 'blame with excessive --abbrev and -b culls to hash length' ' |
| 32 | + cat >expect <<-EOF && |
| 33 | +- $(printf "%0.s " $(test_seq $hexsz)) (<author@example.com> 2005-04-07 15:45:13 -0700 1) abbrev |
| 34 | ++ $(printf "%${hexsz}s" "") (<author@example.com> 2005-04-07 15:45:13 -0700 1) abbrev |
| 35 | + EOF |
| 36 | + git blame -b --abbrev=9000 ^HEAD -- abbrev.t >actual && |
| 37 | + test_cmp expect actual |
| 38 | +-- |
| 39 | +2.48.0 |
| 40 | + |
0 commit comments