summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorrl1987 <rl1987@sdf.lonestar.org>2019-03-01 17:38:37 +0200
committerrl1987 <rl1987@sdf.lonestar.org>2019-03-10 18:28:06 +0200
commit2d3ef34dcebf360a98d875639484c8e92274b19b (patch)
tree4b5eadfbf59dfbed3d7c53e4f81be4d75d966838 /scripts
parent911f95ed9203225f74b16b28dc46c76caf57f227 (diff)
downloadtor-2d3ef34dcebf360a98d875639484c8e92274b19b.tar.gz
tor-2d3ef34dcebf360a98d875639484c8e92274b19b.zip
Add post-merge git hook to warn about git hooks being updated in the repo
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/maint/post-merge.git-hook24
1 files changed, 24 insertions, 0 deletions
diff --git a/scripts/maint/post-merge.git-hook b/scripts/maint/post-merge.git-hook
new file mode 100755
index 0000000000..eb98257f0b
--- /dev/null
+++ b/scripts/maint/post-merge.git-hook
@@ -0,0 +1,24 @@
+#!/bin/sh
+
+git_toplevel=$(git rev-parse --show-toplevel)
+
+check_for_diffs() {
+ installed="$git_toplevel/.git/hooks/$1"
+ latest="$git_toplevel/scripts/maint/$1.git-hook"
+
+ if [ -e "$installed" ]
+ then
+ if ! cmp "$installed" "$latest" >/dev/null 2>&1
+ then
+ echo "ATTENTION: $1 hook has changed:"
+ echo "==============================="
+ diff "$installed" "$latest"
+ exit 1
+ fi
+ fi
+}
+
+check_for_diffs "pre-push"
+check_for_diffs "pre-commit"
+check_for_diffs "post-merge"
+