On Mon, Jun 23, 2025 at 6:57 AM Jeff King <peff@xxxxxxxx> wrote: > 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@xxxxxxxx> > --- > diff --git 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' > - printf "[submodule \"sm-$i\"]\npath = recursive-submodule-path-$i\n" "$i" || > + echo "[submodule \"sm-$i\"]" && > + echo "path = recursive-submodule-path-$i" || This looks obviously correct and, as the commit message says, is almost certainly easier to read, but I was more than a little surprised to see the patch since I thought this code had been fixed previously[*] and had some discussion around it. [*] https://lore.kernel.org/git/20250403144852.19153-1-sn03.general@xxxxxxxxx/