unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Paul Eggert <eggert@cs.ucla.edu>
To: Emacs Development <Emacs-devel@gnu.org>
Subject: preferring https: to http: in commit messages for gnu.org
Date: Sun, 15 Oct 2017 00:14:04 -0700	[thread overview]
Message-ID: <61bfc72e-b21f-3fb9-25b7-b718bb69d85b@cs.ucla.edu> (raw)

[-- Attachment #1: Type: text/plain, Size: 269 bytes --]

I installed the attached into the default Git commit hooks to help remind us 
(and particularly to remind me, since I write a fair number of these things) 
that https: should be preferred to http: in commit-message URLs that point to 
gnu.org or fsf.org web sites.

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Encourage-https-in-commit-messages.patch --]
[-- Type: text/x-patch; name="0001-Encourage-https-in-commit-messages.patch", Size: 1826 bytes --]

From 3c78960a4755d7bd583a0411d7089a0c13c0c64b Mon Sep 17 00:00:00 2001
From: Paul Eggert <eggert@day>
Date: Sat, 14 Oct 2017 19:16:12 -0700
Subject: [PATCH] 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 @@ at_sign=
         non_print = "[^[:print:]]"
       }
     }
+    c_lower = "abcdefghijklmnopqrstuvwxyz"
+    unsafe_gnu_url = "(http|ftp)://([" c_lower ".]*\\.)?(gnu|fsf)\\.org"
   }
 
   /^#/ {
@@ -125,6 +127,14 @@ at_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
-- 
2.7.4


             reply	other threads:[~2017-10-15  7:14 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-15  7:14 Paul Eggert [this message]
2017-10-15 14:25 ` preferring https: to http: in commit messages for gnu.org Eli Zaretskii
2017-10-16  7:07   ` Paul Eggert
2017-10-16 15:09     ` Eli Zaretskii
2017-10-16 15:19       ` Yuri Khan
2017-10-16 16:20         ` Robert Pluim
2017-10-16 18:47           ` Paul Eggert
2017-10-16 18:54             ` Eli Zaretskii
2017-10-16 23:15       ` Paul Eggert

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=61bfc72e-b21f-3fb9-25b7-b718bb69d85b@cs.ucla.edu \
    --to=eggert@cs.ucla.edu \
    --cc=Emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).