aboutsummaryrefslogtreecommitdiffstats
path: root/build-aux/git-hooks/commit-msg
diff options
context:
space:
mode:
authorjave2014-12-31 12:24:10 +0100
committerjave2014-12-31 12:24:10 +0100
commitbaba9e039136e183e055169ddd7ca1e983fc734f (patch)
tree9168fb077980351a25ea3a112f2abd105a11099a /build-aux/git-hooks/commit-msg
parent4105b6a93047045553e10795742a808b805c85b7 (diff)
parent25346768fac53687c97c213fb99ff18fa805b073 (diff)
downloademacs-baba9e039136e183e055169ddd7ca1e983fc734f.tar.gz
emacs-baba9e039136e183e055169ddd7ca1e983fc734f.zip
merge upstream
Diffstat (limited to 'build-aux/git-hooks/commit-msg')
-rwxr-xr-xbuild-aux/git-hooks/commit-msg20
1 files changed, 12 insertions, 8 deletions
diff --git a/build-aux/git-hooks/commit-msg b/build-aux/git-hooks/commit-msg
index 5eb994c6fe0..9b6179ee613 100755
--- a/build-aux/git-hooks/commit-msg
+++ b/build-aux/git-hooks/commit-msg
@@ -87,8 +87,17 @@ exec $awk '
87 status = 1 87 status = 1
88 } 88 }
89 89
90 72 < length && $0 ~ space { 90 {
91 print "Line longer than 72 characters in commit message" 91 # Expand tabs to spaces for length calculations etc.
92 while (match($0, /\t/)) {
93 before_tab = substr($0, 1, RSTART - 1)
94 after_tab = substr($0, RSTART + 1)
95 $0 = sprintf("%s%*s%s", before_tab, 8 - (RSTART - 1) % 8, "", after_tab)
96 }
97 }
98
99 78 < length && $0 ~ space {
100 print "Line longer than 78 characters in commit message"
92 status = 1 101 status = 1
93 } 102 }
94 103
@@ -103,12 +112,7 @@ exec $awk '
103 } 112 }
104 113
105 $0 ~ non_print { 114 $0 ~ non_print {
106 if (gsub(/\t/, "")) { 115 print "Unprintable character in commit message"
107 print "Tab in commit message; please use spaces instead"
108 }
109 if ($0 ~ non_print) {
110 print "Unprintable character in commit message"
111 }
112 status = 1 116 status = 1
113 } 117 }
114 118