Re: [PATCH] var: add GIT_COMMENT_STRING
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Nov 24, 2026, 20:24 UTC
- Message-ID
- <xmqqh5h6ou4q.fsf@gitster.g>
- In-Reply-To
- <fa8b80af26481e0dc96fd8f80f3c7ba84f60f9d4.1795516651.git.phillip.wood@dunelm.org.uk>
Phillip Wood <phillip.wood123@gmail.com> writes:
Show 17 quoted lines
> From: Phillip Wood <phillip.wood@dunelm.org.uk>
>
> Since commit 9ccf3e9b22 (config: add core.commentString, 2024-03-27) we
> have two separate config keys that set the comment string used by git
> when creating template commit messages etc. As that commit notes, when
> core.commentString is set to a multi-byte string, it can be useful to
> keep core.commentChar set to a single chararcter for compatibilty with
> older versions of git. That makes it awkward for scripts to determine
> what the comment chararcter is because they need to do something like
>
> {
> echo ' #'
> git config --get-regex '^core.comment(char|string)$'
> } | sed -n '$s/^[^ ] //p'
>
> Add GIT_COMMENT_STRING to "git var" to make it easier for scripts to
> determine the comment character.It is somewhat unfortunate that we honor last-one-wins across two variables (otherwise it would have been just the matter of using core.commentString, falling back to core.commentChar).
But the motivation is good.