Re: [PATCH v3 3/3] run-command: show prepared command

Junio C Hamano
2024-05-23T23:40:31Z

Junio C Hamano <gitster@pobox.com> writes:

>> + git config alias.echo "!echo \$*" &&
>> + env GIT_TRACE=1 git echo argument 2>output &&
>> + cp output /tmp/output &&
>> + test_grep "^trace: prepare_cmd: /bin/sh -c '\''echo \$\* \"\$@\"" output
>> +'
>
> This is probably too specific search string, ...

And of course, 'seen' no longer passes the test with this topic
merged when run with SHELL_PATH=/bin/dash for obvious reasons.

I've added the following band-aid to help 'seen' pass CI, but this
has to be fixed in the main patch by squashing it in.

Thanks.

--- >8 ---
Subject: [PATCH] fixup! run-command: show prepared command

Do not assume everybody sets SHELL_PATH to /bin/sh
---
t/t0014-alias.sh | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/t/t0014-alias.sh b/t/t0014-alias.sh
index 75c8763a6c..0d42d2b454 100755
--- a/t/t0014-alias.sh
+++ b/t/t0014-alias.sh
@@ -48,7 +48,8 @@ test_expect_success 'tracing a shell alias with arguments shows full prepared co
git config alias.echo "!echo \$*" &&
env GIT_TRACE=1 git echo argument 2>output &&
cp output /tmp/output &&
- test_grep "^trace: prepare_cmd: /bin/sh -c '\''echo \$\* \"\$@\"" output
+ # ".*" can be "sh", or SHELL_PATH (not always "/bin/sh")
+ test_grep "^trace: prepare_cmd: .* -c '\''echo \$\* \"\$@\"" output
'

test_done
--
2.45.1-246-gb9cfe4845c