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:00:26 -0700

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

That's interesting in that I find it unusual.  Fine as long as it
works ;-)

> Maybe I'm missing something but don't we want to ensure that we have a
> non-empty message here? Also as it is a single command we can avoid
> the subshell with
>
>     GIT_EDITOR="echo hello >" git commit

Yeah, that does sound better.