aboutsummaryrefslogtreecommitdiffstats
path: root/build-aux/git-hooks/commit-msg
diff options
context:
space:
mode:
authorPaul Eggert2017-10-14 19:16:12 -0700
committerPaul Eggert2017-10-14 19:19:24 -0700
commit3c78960a4755d7bd583a0411d7089a0c13c0c64b (patch)
tree30f58d39973a4878d4a71b15e1d79b70e5baf9a7 /build-aux/git-hooks/commit-msg
parentdef9715282f71953740e8b92cf6443bfc459dd41 (diff)
downloademacs-3c78960a4755d7bd583a0411d7089a0c13c0c64b.tar.gz
emacs-3c78960a4755d7bd583a0411d7089a0c13c0c64b.zip
Encourage https: in commit messages
* CONTRIBUTE: Prefer https: when citing. * build-aux/git-hooks/commit-msg: Diagnose http: and ftp: URLs to FSF or GNU hosts.
Diffstat (limited to 'build-aux/git-hooks/commit-msg')
-rwxr-xr-xbuild-aux/git-hooks/commit-msg10
1 files changed, 10 insertions, 0 deletions
diff --git a/build-aux/git-hooks/commit-msg b/build-aux/git-hooks/commit-msg
index 39450865cb8..e21aaf074c6 100755
--- a/build-aux/git-hooks/commit-msg
+++ b/build-aux/git-hooks/commit-msg
@@ -66,6 +66,8 @@ exec $awk -v at_sign="$at_sign" -v cent_sign="$cent_sign" '
66 non_print = "[^[:print:]]" 66 non_print = "[^[:print:]]"
67 } 67 }
68 } 68 }
69 c_lower = "abcdefghijklmnopqrstuvwxyz"
70 unsafe_gnu_url = "(http|ftp)://([" c_lower ".]*\\.)?(gnu|fsf)\\.org"
69 } 71 }
70 72
71 /^#/ { 73 /^#/ {
@@ -125,6 +127,14 @@ exec $awk -v at_sign="$at_sign" -v cent_sign="$cent_sign" '
125 status = 1 127 status = 1
126 } 128 }
127 129
130 {
131 if (match($0, unsafe_gnu_url)) {
132 url = substr($0, RSTART, RLENGTH)
133 printf "Use https: URL instead of '\''%s'\'' in commit message\n", url
134 status = 1
135 }
136 }
137
128 $0 ~ non_print { 138 $0 ~ non_print {
129 print "Unprintable character in commit message" 139 print "Unprintable character in commit message"
130 status = 1 140 status = 1