aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Eggert2015-04-10 19:12:16 -0700
committerPaul Eggert2015-04-10 19:12:16 -0700
commit89b2bf617fa0619d57e8875d6d15aa765d765482 (patch)
tree39db8c7d7ea7fb1d466d53bd20dbe8b847955543
parentc0984249eb65641a0876594183c80fd8e6b37962 (diff)
downloademacs-89b2bf617fa0619d57e8875d6d15aa765d765482.tar.gz
emacs-89b2bf617fa0619d57e8875d6d15aa765d765482.zip
Have commit-msg report commit failure
* build-aux/git-hooks/commit-msg: If the commit is aborted, say so. Simplify by doing this at the end. Problem reported by Eli Zaretskii in: http://lists.gnu.org/archive/html/emacs-devel/2015-04/msg00566.html
-rwxr-xr-xbuild-aux/git-hooks/commit-msg19
1 files changed, 11 insertions, 8 deletions
diff --git a/build-aux/git-hooks/commit-msg b/build-aux/git-hooks/commit-msg
index 13a05351ded..6721d53a582 100755
--- a/build-aux/git-hooks/commit-msg
+++ b/build-aux/git-hooks/commit-msg
@@ -63,7 +63,7 @@ exec $awk '
63 /^#/ { next } 63 /^#/ { next }
64 64
65 !/^.*$/ { 65 !/^.*$/ {
66 print "Invalid character (not UTF-8) in commit message; see 'CONTRIBUTE'" 66 print "Invalid character (not UTF-8) in commit message"
67 status = 1 67 status = 1
68 } 68 }
69 69
@@ -77,13 +77,13 @@ exec $awk '
77 sub(/^squash! /, "") 77 sub(/^squash! /, "")
78 78
79 if ($0 ~ "^" space) { 79 if ($0 ~ "^" space) {
80 print "White space at start of commit message'\''s first line; see 'CONTRIBUTE'" 80 print "White space at start of commit message'\''s first line"
81 status = 1 81 status = 1
82 } 82 }
83 } 83 }
84 84
85 nlines == 2 && $0 ~ non_space { 85 nlines == 2 && $0 ~ non_space {
86 print "Nonempty second line in commit message; see 'CONTRIBUTE'" 86 print "Nonempty second line in commit message"
87 status = 1 87 status = 1
88 } 88 }
89 89
@@ -97,30 +97,33 @@ exec $awk '
97 } 97 }
98 98
99 78 < length && $0 ~ space { 99 78 < length && $0 ~ space {
100 print "Line longer than 78 characters in commit message; see 'CONTRIBUTE'" 100 print "Line longer than 78 characters in commit message"
101 status = 1 101 status = 1
102 } 102 }
103 103
104 140 < length { 104 140 < length {
105 print "Word longer than 140 characters in commit message; see 'CONTRIBUTE'" 105 print "Word longer than 140 characters in commit message"
106 status = 1 106 status = 1
107 } 107 }
108 108
109 /^Signed-off-by: / { 109 /^Signed-off-by: / {
110 print "'\''Signed-off-by:'\'' in commit message; see 'CONTRIBUTE'" 110 print "'\''Signed-off-by:'\'' in commit message"
111 status = 1 111 status = 1
112 } 112 }
113 113
114 $0 ~ non_print { 114 $0 ~ non_print {
115 print "Unprintable character in commit message; see 'CONTRIBUTE'" 115 print "Unprintable character in commit message"
116 status = 1 116 status = 1
117 } 117 }
118 118
119 END { 119 END {
120 if (nlines == 0) { 120 if (nlines == 0) {
121 print "Empty commit message; see 'CONTRIBUTE'" 121 print "Empty commit message"
122 status = 1 122 status = 1
123 } 123 }
124 if (status != 0) {
125 print "Commit aborted; please see the file 'CONTRIBUTE'"
126 }
124 exit status 127 exit status
125 } 128 }
126' <"$1" 129' <"$1"