summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSalvatore Bonaccorso <carnil@debian.org>2017-12-29 19:17:02 +0000
committerSalvatore Bonaccorso <carnil@debian.org>2017-12-29 19:17:02 +0000
commit01950495e1cf950ed86b2f7ea4b5512ed243af23 (patch)
treecdcf9c5116f0f48301e6df53f72eee803519c403
parent6ab7f10fd0ec46356e2b430ace597c6211b48c15 (diff)
Add pre-commit hook to check syntax
git-svn-id: svn+ssh://svn.debian.org/svn/secure-testing@59028 e39458fd-73e7-0310-bf30-c45bca0a0e42
-rwxr-xr-xbin/setup-repo31
-rwxr-xr-xconf/pre-commit12
2 files changed, 43 insertions, 0 deletions
diff --git a/bin/setup-repo b/bin/setup-repo
new file mode 100755
index 0000000000..ef7cf2c95b
--- /dev/null
+++ b/bin/setup-repo
@@ -0,0 +1,31 @@
+#!/bin/sh
+#
+# Set up a clone of the security-tracker git repo
+
+set -e
+
+SRC=../../conf/pre-commit
+HOOK=.git/hooks/pre-commit
+
+install_pre_commit_hook() {
+ if [ -L "${HOOK}" ] && [ "$(readlink ${HOOK})" = "${SRC}" ]; then
+ echo "pre-commit hook already set up"
+ return
+ fi
+
+ if [ -e "${HOOK}" ] || [ -L "${HOOK}" ]; then
+ echo "Moving old pre-commit hook"
+ mv -f "${HOOK}" "${HOOK}.$(date '+%s')"
+ fi
+
+ echo "Installing pre-commit hook"
+ ln -s "${SRC}" "${HOOK}"
+}
+
+
+if [ "$(git rev-parse --show-cdup)" != '' ] || [ -d data/CVE/list ]; then
+ echo "This does not look like the git repo of the security tracker" 1>&2
+ exit 1
+fi
+
+install_pre_commit_hook
diff --git a/conf/pre-commit b/conf/pre-commit
new file mode 100755
index 0000000000..f097a88abd
--- /dev/null
+++ b/conf/pre-commit
@@ -0,0 +1,12 @@
+#!/bin/sh
+
+set -e
+
+if [ -z "${GIT_DIR}" ]; then
+ echo "GIT_DIR not set" 1>&2
+ exit 1
+fi
+
+exec 1>&2
+
+make check-syntax

© 2014-2024 Faster IT GmbH | imprint | privacy policy