Re: [PATCH v2 2/3] config: values of pathname type can be prefixed with :(optional)
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Oct 6, 2025, 20:21 UTC
- Message-ID
- <xmqqms63ok7g.fsf@gitster.g>
- In-Reply-To
- <xmqqsefvol7s.fsf@gitster.g>
Junio C Hamano <gitster@pobox.com> writes:
> We'd probably need a preliminary clean-up patch to fix all of these > in the vicinity.
So, here is the preliminary clea-up step that should come before [2/3]
--- >8 --- Subject: [PATCH] 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 thest 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> --- t/t7500-commit-template-squash-signoff.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/t/t7500-commit-template-squash-signoff.sh b/t/t7500-commit-template-squash-signoff.sh index 05cda50186..4922543256 100755 --- a/t/t7500-commit-template-squash-signoff.sh +++ b/t/t7500-commit-template-squash-signoff.sh @@ -31,7 +31,7 @@ test_expect_success 'nonexistent template file should return error' ' echo changes >> foo && git add foo && ( - GIT_EDITOR="echo hello >\"\$1\"" && + GIT_EDITOR="echo hello >" && export GIT_EDITOR && test_must_fail git commit --template "$PWD"/notexist ) @@ -40,7 +40,7 @@ test_expect_success 'nonexistent template file should return error' ' test_expect_success 'nonexistent template file in config should return error' ' test_config commit.template "$PWD"/notexist && ( - GIT_EDITOR="echo hello >\"\$1\"" && + GIT_EDITOR="echo hello >" && export GIT_EDITOR && test_must_fail git commit --allow-empty )
-- 2.51.0-580-g8258b70b6e