[tor-commits] [tor/master] Add post-merge git hook to warn about git hooks being updated in the repo

asn at torproject.org asn at torproject.org
Wed Mar 13 14:08:02 UTC 2019


commit 2d3ef34dcebf360a98d875639484c8e92274b19b
Author: rl1987 <rl1987 at sdf.lonestar.org>
Date:   Fri Mar 1 17:38:37 2019 +0200

    Add post-merge git hook to warn about git hooks being updated in the repo
---
 scripts/maint/post-merge.git-hook | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/scripts/maint/post-merge.git-hook b/scripts/maint/post-merge.git-hook
new file mode 100755
index 000000000..eb98257f0
--- /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"
+





More information about the tor-commits mailing list