diff options
| author | Jeff King <peff@peff.net> | 2025-06-23 06:55:42 -0400 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2025-06-23 10:30:40 -0700 |
| commit | 1129596dc88a5b0ad53e0d36981bd91c2352cba8 (patch) | |
| tree | 3ed8825b558da0b6189f4adda7537df16fc87a8c /t/t7422-submodule-output.sh | |
| parent | 16bd9f20a403117f2e0d9bcda6c6e621d3763e77 (diff) | |
| download | git-1129596dc88a5b0ad53e0d36981bd91c2352cba8.tar.gz | |
t7422: replace confusing printf with echo
While looping over a counter "i", we do:
printf "[submodule \"sm-$i\"]\npath = recursive-submodule-path-$i\n" "$i"
So we are passing "$i" as an argument to be filled in, but there is no
"%" placeholder in the format string, which is a bit confusing to read.
We could switch both instances of "$i" to "%d" (and pass $i twice). But
that makes the line even longer. Let's just keep interpolating the value
in the string, and drop the confusing extra "$i" argument.
And since we are not using any printf specifiers at all, it becomes
clear that we can swap it out for echo. We do use a "\n" in the middle
of the string, but breaking this into two separate echo statements
actually makes it easier to read.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t7422-submodule-output.sh')
| -rwxr-xr-x | t/t7422-submodule-output.sh | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/t/t7422-submodule-output.sh b/t/t7422-submodule-output.sh index 023a5cbdc4..ea67057f1a 100755 --- a/t/t7422-submodule-output.sh +++ b/t/t7422-submodule-output.sh @@ -180,7 +180,8 @@ test_expect_success !MINGW 'git submodule status --recursive propagates SIGPIPE' COMMIT=$(git rev-parse HEAD) && for i in $(test_seq 2000) do - printf "[submodule \"sm-$i\"]\npath = recursive-submodule-path-$i\n" "$i" || + echo "[submodule \"sm-$i\"]" && + echo "path = recursive-submodule-path-$i" || return 1 done >gitmodules && BLOB=$(git hash-object -w --stdin <gitmodules) && |
