Subject: Re: [PATCH v2 2/3] config: values of pathname type can be prefixed with :(optional)

From: Junio C Hamano <[email-masked]>
Date: Mon, 06 Oct 2025 12:59:19 -0700

Junio C Hamano <[email-masked]> writes:

> Phillip Wood <[email-masked]> writes:
>
>>> +	test_config commit.template ":(optional)$PWD"/notexist &&
>>> +	(
>>> +		GIT_EDITOR="echo hello >\"\$1\"" &&
>>
>> when git runs the editor this will be expanded to
>>
>>     sh -c 'echo hello >"$1" "$@"' 'echo hello >"$1"' path/to/file
>>
>> I think it should be
>>
>>     GIT_EDITOR="echo hello >"
>>
>> instead

It seems that this was a copy-paste from a few of tests before this
new piece.  They all _expect_ to fail, so probably nobody bothered
to inspect the outcome ;-)

I just looked at what actually goes to COMMIT_EDITMSG with this test
that expects to succeed.

$ cat .git/COMMIT_EDITMSG
hello /home/gitster/w/git.git/t/trash directory.t7500-commit-template-squash-signoff/.git/COMMIT_EDITMSG

So, you're right to say "$@" will be given in addition to "hello" as
arguments to "echo".  That extra argument is to tell the editor the
path to the edited file.

We'd probably need a preliminary clean-up patch to fix all of these
in the vicinity.

Thanks.