summaryrefslogtreecommitdiff
path: root/scripts/git/post-merge.git-hook
diff options
context:
space:
mode:
authorrl1987 <rl1987@sdf.lonestar.org>2019-03-06 19:45:58 +0200
committerrl1987 <rl1987@sdf.lonestar.org>2019-03-10 18:28:06 +0200
commit888bb9508b7a89550d3b2d33236073fc14868a98 (patch)
tree89fd2ac7e9133de9f74354d00c26d07790b25114 /scripts/git/post-merge.git-hook
parent7b5f31f2d6bea00d6e67d0f387dbc79398192c66 (diff)
downloadtor-888bb9508b7a89550d3b2d33236073fc14868a98.tar.gz
tor-888bb9508b7a89550d3b2d33236073fc14868a98.zip
Move all git maintenance scripts to separate directory
Diffstat (limited to 'scripts/git/post-merge.git-hook')
-rwxr-xr-xscripts/git/post-merge.git-hook44
1 files changed, 44 insertions, 0 deletions
diff --git a/scripts/git/post-merge.git-hook b/scripts/git/post-merge.git-hook
new file mode 100755
index 0000000000..300684a9b6
--- /dev/null
+++ b/scripts/git/post-merge.git-hook
@@ -0,0 +1,44 @@
+#!/bin/sh
+
+# This is post-merge git hook script to check for changes in:
+# * git hook scripts
+# * helper scripts for using git efficiently.
+# If any changes are detected, a diff of them is printed.
+#
+# To install this script, copy it to .git/hooks/post-merge in local copy of
+# tor git repo and make sure it has permission to execute.
+
+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"
+ fi
+ fi
+}
+
+check_for_script_update() {
+ fullpath="$git_toplevel/scripts/maint/$1"
+
+ if ! git diff ORIG_HEAD HEAD --exit-code -- "$fullpath" >/dev/null
+ then
+ echo "ATTENTION: $1 has changed:"
+ git diff ORIG_HEAD HEAD -- "$fullpath"
+ fi
+}
+
+check_for_diffs "pre-push"
+check_for_diffs "pre-commit"
+check_for_diffs "post-merge"
+
+check_for_script_update "git-merge-forward.sh"
+check_for_script_update "git-pull-all.sh"
+check_for_script_update "git-push-all.sh"