[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] emacs-24 9ac0332: Improve commit-msg messages and autosqua
From: |
Paul Eggert |
Subject: |
[Emacs-diffs] emacs-24 9ac0332: Improve commit-msg messages and autosquash |
Date: |
Thu, 11 Dec 2014 04:45:06 +0000 |
branch: emacs-24
commit 9ac033203005ba53c4f1e65fcb44ae95edf1b402
Author: Paul Eggert <address@hidden>
Commit: Paul Eggert <address@hidden>
Improve commit-msg messages and autosquash
Problem reported by Michal Nazarewicz in Bug#19337.
* build-aux/git-hooks/commit-msg: Add "commit message" to
diagnostics. Distinguish better between tabs and other
unprintable chars in diagnostics. Don't complain if a prefix
"fixup! " or "squash! " makes a summary line too long.
---
ChangeLog | 9 +++++++++
build-aux/git-hooks/commit-msg | 39 +++++++++++++++++++++++++--------------
2 files changed, 34 insertions(+), 14 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 4a7b590..d4a4f28 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2014-12-11 Paul Eggert <address@hidden>
+
+ Improve commit-msg messages and autosquash
+ Problem reported by Michal Nazarewicz in Bug#19337.
+ * build-aux/git-hooks/commit-msg: Add "commit message" to
+ diagnostics. Distinguish better between tabs and other
+ unprintable chars in diagnostics. Don't complain if a prefix
+ "fixup! " or "squash! " makes a summary line too long.
+
2014-12-08 Paul Eggert <address@hidden>
Port commit-message checking to FreeBSD 9.
diff --git a/build-aux/git-hooks/commit-msg b/build-aux/git-hooks/commit-msg
index f407881..d2a0c59 100755
--- a/build-aux/git-hooks/commit-msg
+++ b/build-aux/git-hooks/commit-msg
@@ -49,7 +49,7 @@ exec $awk '
/^#/ { next }
!/^.*$/ {
- print "Invalid character (not UTF-8)"
+ print "Invalid character (not UTF-8) in commit message"
status = 1
}
@@ -57,39 +57,50 @@ exec $awk '
{ nlines++ }
- nlines == 1 && /^[[:space:]]/ {
- print "White space at start of first line"
- status = 1
- }
+ nlines == 1 {
+ # Ignore special markers used by "git rebase --autosquash".
+ if (! sub(/^fixup! /, ""))
+ sub(/^squash! /, "")
- nlines == 2 && /[^[:space:]]/ {
- print "Nonempty second line"
- status = 1
+ if (/^[[:space:]]/) {
+ print "White space at start of commit message'\''s first line"
+ status = 1
+ }
}
- /[^[:print:]]/ {
- print "Unprintable character; please use spaces instead of tabs"
+ nlines == 2 && /[^[:space:]]/ {
+ print "Nonempty second line in commit message"
status = 1
}
72 < length && /[[:space:]]/ {
- print "Line longer than 72 characters"
+ print "Line longer than 72 characters in commit message"
status = 1
}
140 < length {
- print "Word longer than 140 characters"
+ print "Word longer than 140 characters in commit message"
status = 1
}
/^Signed-off-by: / {
- print "'\''Signed-off-by:'\'' present"
+ print "'\''Signed-off-by:'\'' in commit message"
+ status = 1
+ }
+
+ /[^[:print:]]/ {
+ if (gsub(/\t/, "")) {
+ print "Tab in commit message; please use spaces instead"
+ }
+ if (/[^[:print:]]/) {
+ print "Unprintable character in commit message"
+ }
status = 1
}
END {
if (nlines == 0) {
- print "Empty change log entry"
+ print "Empty commit message"
status = 1
}
exit status
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] emacs-24 9ac0332: Improve commit-msg messages and autosquash,
Paul Eggert <=