git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
Junio C Hamano <gitster@pobox.com>
Date
Jul 31, 2025, 20:49 UTC
Message-ID
<xmqqwm7oozku.fsf@gitster.g>
In-Reply-To
<a6355451d4b22730ffd20eb5ea5e820582d20b03.1753975294.git.phillip.wood@dunelm.org.uk>
Phillip Wood <phillip.wood123@gmail.com> writes:
Show 7 quoted lines
> From: Phillip Wood <phillip.wood@dunelm.org.uk>
>
> 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".
Show 27 quoted lines
> 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".
Show 31 quoted lines
> 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 <phillip.wood@dunelm.org.uk>
> ---
>  +
> -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.
Previous: Phillip WoodNext: Phillip Wood
Message 20 of 45 in “breaking-changes: deprecate support for core.commentChar=auto”
  1. 0/2 breaking-changes: deprecate support for core.commentChar=autoPhillip Wood, Jul 8, 2025
  2. 1/2 breaking-changes: deprecate support for core.commentString=autoPhillip Wood, Jul 8, 2025
  3. Ayush ChandekarJul 8, 2025
  4. Phillip WoodJul 9, 2025
  5. 2/2 commit: print advice when core.commentString=autoPhillip Wood, Jul 8, 2025
  6. Junio C HamanoJul 8, 2025
  7. Phillip WoodJul 9, 2025
  8. Junio C HamanoJul 9, 2025
  9. Phillip WoodJul 11, 2025
  10. Junio C HamanoJul 11, 2025
  11. Oswald BuddenhagenJul 12, 2025
  12. Junio C HamanoJul 12, 2025
  13. Junio C HamanoJul 26, 2025
  14. Phillip WoodJul 27, 2025
  15. Junio C HamanoJul 9, 2025
  16. Ayush ChandekarJul 9, 2025
  17. Phillip WoodJul 9, 2025
  18. 0/3 breaking-changes: deprecate support for core.commentChar=autoPhillip Wood, Jul 31, 2025
  19. 1/3 breaking-changes: deprecate support for core.commentString=autoPhillip Wood, Jul 31, 2025
  20. Junio C HamanoJul 31, 2025
  21. 2/3 config: warn on core.commentString=autoPhillip Wood, Jul 31, 2025
  22. Junio C HamanoJul 31, 2025
  23. Phillip WoodAug 1, 2025
  24. Oswald BuddenhagenAug 1, 2025
  25. 3/3 commit: print advice when core.commentString=autoPhillip Wood, Jul 31, 2025
  26. Oswald BuddenhagenAug 1, 2025
  27. Junio C HamanoAug 1, 2025
  28. Phillip WoodAug 26, 2025
  29. Oswald BuddenhagenAug 27, 2025
  30. Junio C HamanoAug 27, 2025
  31. Oswald BuddenhagenAug 27, 2025
  32. Junio C HamanoAug 1, 2025
  33. Phillip WoodAug 1, 2025
  34. Junio C HamanoAug 1, 2025
  35. 0/3 breaking-changes: deprecate support for core.commentChar=autoPhillip Wood, Aug 26, 2025
  36. 1/3 breaking-changes: deprecate support for core.commentString=autoPhillip Wood, Aug 26, 2025
  37. 3/3 commit: print advice when core.commentString=autoPhillip Wood, Aug 26, 2025
  38. 2/3 config: warn on core.commentString=autoPhillip Wood, Aug 26, 2025
  39. Junio C HamanoAug 26, 2025
  40. Phillip WoodAug 27, 2025
  41. Junio C HamanoAug 27, 2025
  42. 0/3 breaking-changes: deprecate support for core.commentChar=autoPhillip Wood, Aug 27, 2025
  43. 1/3 breaking-changes: deprecate support for core.commentString=autoPhillip Wood, Aug 27, 2025
  44. 2/3 config: warn on core.commentString=autoPhillip Wood, Aug 27, 2025
  45. 3/3 commit: print advice when core.commentString=autoPhillip Wood, Aug 27, 2025

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.