coreutils
[Top][All Lists]
Advanced

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

enforcing commit log policy


From: Jim Meyering
Subject: enforcing commit log policy
Date: Sat, 12 Nov 2011 23:06:43 +0100

FYI, I've just pushed this.

We have some guidelines on the form of commit log messages
(see HACKING's "Commit log requirements").
A week or two ago I added to scripts/git-hooks/ some of the
hooks I've been using to keep myself in line.

Now, I'm adding a little shell code to bootstrap.conf that
copies those hooks into your .git/hooks directory each time
you run bootstrap.  I.e., this is imposing our policies on your
local commits.

If you don't like the policy, you may circumvent it using git-commit's
--no-verify (-n) option -- or run chmod a-x on the hook scripts, but if
you do that, please be sure you don't push the non-conforming commit to
the public repository.

>From 4df39704b819a4ef86c34963e0448263732cf455 Mon Sep 17 00:00:00 2001
From: Jim Meyering <address@hidden>
Date: Sat, 12 Nov 2011 22:48:12 +0100
Subject: [PATCH] maint: install customized git hooks to keep commit logs
 consistent

* bootstrap.conf (buildreq): Copy (with backup) coreutils-supplied
git hooks into .git/hooks, to help keep commit logs normalized.
---
 bootstrap.conf |   14 ++++++++++++++
 1 files changed, 14 insertions(+), 0 deletions(-)

diff --git a/bootstrap.conf b/bootstrap.conf
index d390fb2..cf15008 100644
--- a/bootstrap.conf
+++ b/bootstrap.conf
@@ -330,4 +330,18 @@ bootstrap_epilogue()
   # first grep may well run out of memory.
   perl -pi -e 's/if LC_ALL=C grep .GNU .PACKAGE.*; then/if true; then/' \
     po/Makefile.in.in
+
+  # Install our git hooks, as long as "cp" accepts the --backup option,
+  # so that we can back up any existing files.
+  case $(cp --help) in *--backup*) backup=1;; *) backup=0;; esac
+  if test $backup = 1; then
+    hooks=$(cd scripts/git-hooks && git ls-files)
+    for f in $hooks; do
+      # If it is identical, skip it.
+      cmp scripts/git-hooks/$f .git/hooks/$f > /dev/null \
+        && continue
+      cp --backup=numbered scripts/git-hooks/$f .git/hooks
+      chmod a-w .git/hooks/$f
+    done
+  fi
 }
--
1.7.8.rc0.61.g8a042



reply via email to

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