Subject: Re: [PATCH v2 1/3] breaking-changes: deprecate support for core.commentString=auto

From: Junio C Hamano <[email-masked]>
Date: Thu, 31 Jul 2025 13:49:37 -0700

Phillip Wood <[email-masked]> writes:

> From: Phillip Wood <[email-masked]>
>
> When "core.commentString" is set to "auto" then "git commit" will
> automatically select the comment character ensuring that it is not the
> first character on any of the lines in the commit message. This was
> introduced by commit 84c9dc2c5a2 (commit: allow core.commentChar=auto
> for character auto selection, 2014-05-17) The motivation seems to be

"5-17) The" -> "5-17). The".

> to avoid commenting out lines from the existing message when amending
> a commit that was created with a message from a file.
>
> Unfortunately this feature does not work with:
>
>  * commit message templates that contain comments.
>
>  * prepare-commit-msg hooks that introduce comments.
>
>  * "git commit --cleanup=strip --edit -F <file>" which means that it
>    is incompatible with
>
>    - the "fixup" and "squash" commands of "git rebase -i" as the
>      comments added by those commands are then treated as part of
>      the commit message.
>
>    - the conflict comments added to the commit message by "git
>      cherry-pick", "git rebase" etc. as these comments are then
>      treated as part of the commit message.
>
> It is also ignored by "git notes" when amending a note.
>
> The issues with comments coming from a template, hook or file are a
> consequence of the design of this feature and are therefore hard to
> fix.
>
> As the costs of this feature outweigh the benefits deprecate it and

"the benefits deprecate" -> "the benefits, deprecate".

> remove it in Git 3.0. If someone comes up with some patches that fix
> all the issues in a maintainable way then I'd be happy to see this
> change reverted.
>
> The next commits will add a warning and some advice for users on how
> they can update their config settings.
>
> Signed-off-by: Phillip Wood <[email-masked]>
> ---
>  +
> -If set to "auto", `git-commit` would select a character that is not
> +ifndef::with-breaking-changes[]
> +If set to "auto", `git-commit` will select a character that is not
>  the beginning character of any line in existing commit messages.
> -+
> +Support for this value is deprecated and will be removed in Git 3.0
> +due to the following limitations:
> ++
> +--
> +* It is incompatible with adding comments in a commit message
> +  template. This includes the conflicts comments added to
> +  the commit message by `cherry-pick`, `merge`, `rebase` and
> +  `revert`.
> +* It is incompatible with adding comments to the commit message
> +  in the `prepare-commit-msg` hook.
> +* It is incompatible with the `fixup` and `squash` commands when
> +  rebasing,
> +* It is not respected by `git notes`
> +--
> ++
> +endif::with-breaking-changes[]

The above is shown to everybody before the 3.0 happens (and if you
opt into 3.0 early, you will stop seeing it earlier than others).

The rest of the patch looks good to me.