summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJim Meyering <meyering@redhat.com>2011-11-12 22:48:12 +0100
committerJim Meyering <meyering@redhat.com>2011-11-12 22:49:58 +0100
commit4df39704b819a4ef86c34963e0448263732cf455 (patch)
treea976b875a2a3eadceade87b60fc0dbfa6b5019ce
parent7bd653dada12e0f12f081ea9cccdf85a728052cd (diff)
downloadcoreutils-4df39704b819a4ef86c34963e0448263732cf455.tar.xz
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.
-rw-r--r--bootstrap.conf14
1 files changed, 14 insertions, 0 deletions
diff --git a/bootstrap.conf b/bootstrap.conf
index d390fb22d..cf15008ba 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
}