Skip to content

Commit 1129596

Browse files
peffgitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 16bd9f2 commit 1129596

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

t/t7422-submodule-output.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,8 @@ test_expect_success !MINGW 'git submodule status --recursive propagates SIGPIPE'
180180
COMMIT=$(git rev-parse HEAD) &&
181181
for i in $(test_seq 2000)
182182
do
183-
printf "[submodule \"sm-$i\"]\npath = recursive-submodule-path-$i\n" "$i" ||
183+
echo "[submodule \"sm-$i\"]" &&
184+
echo "path = recursive-submodule-path-$i" ||
184185
return 1
185186
done >gitmodules &&
186187
BLOB=$(git hash-object -w --stdin <gitmodules) &&

0 commit comments

Comments
 (0)