[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lmi-commits] [lmi] master 83122c8: Add pre-commit hook
From: |
Greg Chicares |
Subject: |
[lmi-commits] [lmi] master 83122c8: Add pre-commit hook |
Date: |
Tue, 8 Nov 2016 22:07:05 +0000 (UTC) |
branch: master
commit 83122c8e91288efa50fcc4e5f4556de94edbe060
Author: Gregory W. Chicares <address@hidden>
Commit: Gregory W. Chicares <address@hidden>
Add pre-commit hook
Do this:
cd /opt/lmi/src/lmi
ln --symbolic --force --no-dereference ../hooks .git
to make git use hooks saved in the repository.
---
README.schroot | 6 ++++++
hooks/pre-commit | 47 +++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 53 insertions(+)
diff --git a/README.schroot b/README.schroot
index 1f34f1c..dd4ef07 100644
--- a/README.schroot
+++ b/README.schroot
@@ -248,6 +248,10 @@ chmod +x install_msw.sh
pushd /opt/lmi/bin
wine ./lmi_wx_shared.exe --ash_nazg --data_path=../data
+# Symlink the repository's hooks/ directory:
+cd /opt/lmi/src/lmi
+ln --symbolic --force --no-dereference ../hooks .git
+
# Iff this chroot needs write access to savannah, then reconfigure
# the URL, using your savannah ID instead of mine:
# git remote set-url origin address@hidden:/srv/git/lmi.git
@@ -262,6 +266,8 @@ git clone -b master file:///opt/lmi/blessed/proprietary
# ...and verify it:
cd proprietary
git rev-parse HEAD
+# ...then symlink its hooks/ directory:
+ln --symbolic --force --no-dereference ../hooks .git
# Create and populate the proprietary source directory used by 'vpath':
mkdir --parents /opt/lmi/src/products/src
diff --git a/hooks/pre-commit b/hooks/pre-commit
new file mode 100755
index 0000000..e08795e
--- /dev/null
+++ b/hooks/pre-commit
@@ -0,0 +1,47 @@
+#!/bin/sh
+
+# git pre-commit hook
+
+# git pre-commit hook
+
+# Copyright (C) 2016 Gregory W. Chicares.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License version 2 as
+# published by the Free Software Foundation.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+#
+# http://savannah.nongnu.org/projects/lmi
+# email: <address@hidden>
+# snail: Chicares, 186 Belle Woods Drive, Glastonbury CT 06033, USA
+
+set -e
+
+check_concinnity()
+{
+ output=$( \
+ make src_dir=/opt/lmi/src/lmi -f /opt/lmi/src/lmi/GNUmakefile
check_concinnity \
+ 2>&1 | sed \
+ -e'/^make[[]/d' \
+ -e'/^ Problems detected by xmllint:$/d' \
+ -e'/^ Miscellaneous problems:$/d' \
+ -e'/^ *[0-9][0-9]* \(source files\|source lines\|marked defects\)$/d'
+ )
+ if [ -n "$output" ]; then
+ printf '\n%s\n' "$output"
+ printf "COMMIT ABORTED\n"
+ exit 1
+ fi
+}
+
+printf "checking..."
+check_concinnity
+printf "okay\n"
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [lmi-commits] [lmi] master 83122c8: Add pre-commit hook,
Greg Chicares <=