1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-06 06:20:55 -08:00

; More strongly discountenance Markdown-style quotes

* CONTRIBUTE (Commit messages): Discourage quoting with
Markdown-style pairs of backticks.

* build-aux/git-hooks/prepare-commit-msg: Detect and reject
commit messages with Markdown-style quotes.
This commit is contained in:
Po Lu 2025-02-17 15:17:00 +08:00
parent 89bdb57f24
commit 0e4d08f3dc
2 changed files with 14 additions and 8 deletions

View file

@ -276,10 +276,12 @@ formatting them:
- Emacs follows the GNU coding standards for ChangeLog entries: see - Emacs follows the GNU coding standards for ChangeLog entries: see
https://www.gnu.org/prep/standards/html_node/Change-Logs.html or run https://www.gnu.org/prep/standards/html_node/Change-Logs.html or run
'info "(standards)Change Logs"'. One exception is that commits 'info "(standards)Change Logs"'. One exception is that commits still
still sometimes quote `like-this' (as the standards used to sometimes quote `like-this' (as the standards used to recommend)
recommend) rather than 'like-this' or like this (as they do now), rather than 'like-this' or like this (as they do now), as `...' is
as `...' is so widely used elsewhere in Emacs. so widely used elsewhere in Emacs. Please do not adopt the ugly
Markdown convention where quoting is performed with pairs of backticks
in any circumstances. That is to say, never quote `like this`.
- Some commenting rules in the GNU coding standards also apply - Some commenting rules in the GNU coding standards also apply
to ChangeLog entries: they must be in English, and be complete to ChangeLog entries: they must be in English, and be complete

View file

@ -33,17 +33,21 @@ else
awk="awk" awk="awk"
fi fi
exec $awk ' exec $awk "
# Catch the case when someone ran git-commit with -s option, # Catch the case when someone ran git-commit with -s option,
# which automatically adds Signed-off-by. # which automatically adds Signed-off-by.
/^Signed-off-by: / { /^Signed-off-by: / {
print "'\''Signed-off-by:'\'' in commit message" print \"'Signed-off-by:' in commit message\"
status = 1
}
/(^|[^\\\\])\`[^'\`]+\`/ {
print \"Markdown-style quotes in commit message\"
status = 1 status = 1
} }
END { END {
if (status != 0) { if (status != 0) {
print "Commit aborted; please see the file 'CONTRIBUTE'" print \"Commit aborted; please see the file 'CONTRIBUTE'\"
} }
exit status exit status
} }
' <"$COMMIT_MSG_FILE" " <"$COMMIT_MSG_FILE"