summaryrefslogtreecommitdiff
path: root/build-aux/git-hooks/commit-msg
diff options
context:
space:
mode:
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" '
non_print = "[^[:print:]]"
}
}
+ c_lower = "abcdefghijklmnopqrstuvwxyz"
+ unsafe_gnu_url = "(http|ftp)://([" c_lower ".]*\\.)?(gnu|fsf)\\.org"
}
/^#/ {
@@ -125,6 +127,14 @@ exec $awk -v at_sign="$at_sign" -v cent_sign="$cent_sign" '
status = 1
}
+ {
+ if (match($0, unsafe_gnu_url)) {
+ url = substr($0, RSTART, RLENGTH)
+ printf "Use https: URL instead of '\''%s'\'' in commit message\n", url
+ status = 1
+ }
+ }
+
$0 ~ non_print {
print "Unprintable character in commit message"
status = 1