Merge branch 'pw/3.0-commentchar-auto-deprecation'

"core.commentChar=auto" that attempts to dynamically pick a
suitable comment character is non-workable, as it is too much
trouble to support for little benefit, and is marked as deprecated.

* pw/3.0-commentchar-auto-deprecation:
  commit: print advice when core.commentString=auto
  config: warn on core.commentString=auto
  breaking-changes: deprecate support for core.commentString=auto
This commit is contained in:
Junio C Hamano
2025-09-18 10:07:00 -07:00
14 changed files with 423 additions and 12 deletions

View File

@@ -1176,7 +1176,7 @@ test_expect_success 'rebase -i respects core.commentchar' '
test B = $(git cat-file commit HEAD^ | sed -ne \$p)
'
test_expect_success 'rebase -i respects core.commentchar=auto' '
test_expect_success !WITH_BREAKING_CHANGES 'rebase -i respects core.commentchar=auto' '
test_config core.commentchar auto &&
write_script copy-edit-script.sh <<-\EOF &&
cp "$1" edit-script
@@ -1184,8 +1184,23 @@ test_expect_success 'rebase -i respects core.commentchar=auto' '
test_when_finished "git rebase --abort || :" &&
(
test_set_editor "$(pwd)/copy-edit-script.sh" &&
git rebase -i HEAD^
git rebase -i HEAD^ 2>err
) &&
sed -n "s/^hint: *\$//p; s/^hint: //p; s/^warning: //p" err >actual &&
cat >expect <<-EOF &&
Support for ${SQ}core.commentChar=auto${SQ} is deprecated and will be removed in Git 3.0
To use the default comment string (#) please run
git config unset core.commentChar
To set a custom comment string please run
git config set core.commentChar <comment string>
where ${SQ}<comment string>${SQ} is the string you wish to use.
EOF
test_cmp expect actual &&
test -z "$(grep -ve "^#" -e "^\$" -e "^pick" edit-script)"
'