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, 19:59 UTC
- Message-ID
- <xmqqsefvol7s.fsf@gitster.g>
- In-Reply-To
- <xmqqzfa3onxx.fsf@gitster.g>
Junio C Hamano <gitster@pobox.com> writes:
Show 15 quoted lines
> Phillip Wood <phillip.wood123@gmail.com> 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.