[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] emacs-24 0f9fbb9: Port commit-message checking to FreeBSD
From: |
Paul Eggert |
Subject: |
[Emacs-diffs] emacs-24 0f9fbb9: Port commit-message checking to FreeBSD 9. |
Date: |
Mon, 08 Dec 2014 00:20:52 +0000 |
branch: emacs-24
commit 0f9fbb922cb029b0c36805d260a5db28e25d3dd1
Author: Paul Eggert <address@hidden>
Commit: Paul Eggert <address@hidden>
Port commit-message checking to FreeBSD 9.
This fixes a bug reported by Jan Djärv in:
http://lists.gnu.org/archive/html/emacs-devel/2014-12/msg00704.html
along with some other issues I noticed while testing with FreeBSD.
* build-aux/git-hooks/commit-msg: Prefer gawk if available.
Prefer en_US.UTF-8 to en_US.utf8, as it's more portable.
Work around bug in FreeBSD 9 awk, where /[[:cntrl:]]/ matches
ordinary text characters.
Be less tricky about quoting "'" in a shell script.
---
ChangeLog | 12 ++++++++++++
build-aux/git-hooks/commit-msg | 21 ++++++++++++++-------
2 files changed, 26 insertions(+), 7 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index d7fcd25..3686a68 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2014-12-08 Paul Eggert <address@hidden>
+
+ Port commit-message checking to FreeBSD 9.
+ This fixes a bug reported by Jan Djärv in:
+ http://lists.gnu.org/archive/html/emacs-devel/2014-12/msg00704.html
+ along with some other issues I noticed while testing with FreeBSD.
+ * build-aux/git-hooks/commit-msg: Prefer gawk if available.
+ Prefer en_US.UTF-8 to en_US.utf8, as it's more portable.
+ Work around bug in FreeBSD 9 awk, where /[[:cntrl:]]/ matches
+ ordinary text characters.
+ Be less tricky about quoting "'" in a shell script.
+
2014-12-05 Stefan Monnier <address@hidden>
* .gitignore: Ignore autosave files.
diff --git a/build-aux/git-hooks/commit-msg b/build-aux/git-hooks/commit-msg
index 6a09edd..f407881 100755
--- a/build-aux/git-hooks/commit-msg
+++ b/build-aux/git-hooks/commit-msg
@@ -20,25 +20,32 @@
# Written by Paul Eggert.
+# Prefer gawk if available, as it handles NUL bytes properly.
+if type gawk >/dev/null 2>&1; then
+ awk=gawk
+else
+ awk=awk
+fi
+
# Use a UTF-8 locale if available, so that the UTF-8 check works.
# Use U+00A2 CENT SIGN to test whether the locale works.
cent_sign_utf8_octal='\302\242'
at_sign=`
printf "${cent_sign_utf8_octal}@" |
- awk '{print substr($0, 2)}' 2>/dev/null
+ $awk '{print substr($0, 2)}' 2>/dev/null
`
if test "$at_sign" != @; then
at_sign=`
printf "${cent_sign_utf8_octal}@" |
- LC_ALL=en_US.utf8 awk '{print substr($0, 2)}' 2>/dev/null
+ LC_ALL=en_US.UTF-8 $awk '{print substr($0, 2)}' 2>/dev/null
`
if test "$at_sign" = @; then
- LC_ALL=en_US.utf8; export LC_ALL
+ LC_ALL=en_US.UTF-8; export LC_ALL
fi
fi
# Check the log entry.
-exec awk '
+exec $awk '
/^#/ { next }
!/^.*$/ {
@@ -60,8 +67,8 @@ exec awk '
status = 1
}
- /[[:cntrl:]]/ {
- print "Text contains control character; please use spaces instead of tabs"
+ /[^[:print:]]/ {
+ print "Unprintable character; please use spaces instead of tabs"
status = 1
}
@@ -76,7 +83,7 @@ exec awk '
}
/^Signed-off-by: / {
- print "'Signed-off-by:' present"
+ print "'\''Signed-off-by:'\'' present"
status = 1
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] emacs-24 0f9fbb9: Port commit-message checking to FreeBSD 9.,
Paul Eggert <=