emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] emacs-26 3c78960 1/2: Encourage https: in commit messages


From: Paul Eggert
Subject: [Emacs-diffs] emacs-26 3c78960 1/2: Encourage https: in commit messages
Date: Sat, 14 Oct 2017 22:19:32 -0400 (EDT)

branch: emacs-26
commit 3c78960a4755d7bd583a0411d7089a0c13c0c64b
Author: Paul Eggert <address@hidden>
Commit: Paul Eggert <address@hidden>

    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.
---
 CONTRIBUTE                     |  3 +++
 build-aux/git-hooks/commit-msg | 10 ++++++++++
 2 files changed, 13 insertions(+)

diff --git a/CONTRIBUTE b/CONTRIBUTE
index 8995bb3..c7f3330 100644
--- a/CONTRIBUTE
+++ b/CONTRIBUTE
@@ -175,6 +175,9 @@ them right the first time, so here are guidelines for 
formatting them:
   bug number NNNNN in the debbugs database.  This string is often
   parenthesized, as in "(Bug#19003)".
 
+- When citing URLs, prefer https: to http: when either will do.  In
+  particular, gnu.org and fsf.org URLs should start with "https:".
+
 - Commit messages should contain only printable UTF-8 characters.
 
 - Commit messages should not contain the "Signed-off-by:" lines that
diff --git a/build-aux/git-hooks/commit-msg b/build-aux/git-hooks/commit-msg
index 3945086..e21aaf0 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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]