t7500: fix GIT_EDITOR shell snippet

2140b140 (commit: error out for missing commit message template, 2011-02-25) defined GIT_EDITOR="echo hello >\"\$1\"" for these two tests, with the intention that 'hello' would be written in the given file, but as Phillip Wood points out, GIT_EDITOR is invoked by shell after getting expanded to sh -c 'echo hello >"$1" "$@"' 'echo hello >"$1"' path/to/file which is not what we want. Signed-off-by: Junio C Hamano <gitster@pobox.com>

Junio C Hamano committed Oct 6, 2025 at 13:07 UTC 6b4f07325d039db5b9a10a9228b4320ac1fc1dab
1 file changed +2 -2
t/t7500-commit-template-squash-signoff.sh
+2 -2
@@ -31,7 +31,7 @@ test_expect_success 'nonexistent template file should return error' '
31 echo changes >> foo &&
32 git add foo &&
33 (
34 - GIT_EDITOR="echo hello >\"\$1\"" &&
34 + GIT_EDITOR="echo hello >" &&
35 export GIT_EDITOR &&
36 test_must_fail git commit --template "$PWD"/notexist
37 )
@@ -40,7 +40,7 @@ test_expect_success 'nonexistent template file should return error' '
40 test_expect_success 'nonexistent template file in config should return error' '
41 test_config commit.template "$PWD"/notexist &&
42 (
43 - GIT_EDITOR="echo hello >\"\$1\"" &&
43 + GIT_EDITOR="echo hello >" &&
44 export GIT_EDITOR &&
45 test_must_fail git commit --allow-empty
46 )