瀏覽代碼

Merge branch 'tor-github/pr/780'

George Kadianakis 5 年之前
父節點
當前提交
26b0d95397

+ 4 - 0
changes/ticket29588

@@ -0,0 +1,4 @@
+  o Minor features (developer tools):
+    - Introduce a post-merge git hook script to check if we're pulling in any
+      changes to our git workspace management scripts from upstream. Resolves
+      issue 29588.

+ 0 - 0
scripts/maint/git-merge-forward.sh → scripts/git/git-merge-forward.sh


+ 0 - 0
scripts/maint/git-pull-all.sh → scripts/git/git-pull-all.sh


+ 0 - 0
scripts/maint/git-push-all.sh → scripts/git/git-push-all.sh


+ 45 - 0
scripts/git/post-merge.git-hook

@@ -0,0 +1,45 @@
+#!/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/git/$1.git-hook"
+
+        if [ -e "$installed" ]
+        then
+               if ! cmp "$installed" "$latest" >/dev/null 2>&1
+               then
+                        echo "ATTENTION: $1 hook has changed:"
+                        echo "==============================="
+                        diff -u "$installed" "$latest"
+               fi
+        fi
+}
+
+check_for_script_update() {
+        fullpath="$1"
+
+        if ! git diff ORIG_HEAD HEAD --exit-code -- "$fullpath" >/dev/null
+        then
+                echo "ATTENTION: $1 has changed:"
+                git --no-pager diff ORIG_HEAD HEAD -- "$fullpath"
+        fi
+}
+
+check_for_diffs "pre-push"
+check_for_diffs "pre-commit"
+check_for_diffs "post-merge"
+
+for file in "$git_toplevel"/scripts/git/* ; do
+        check_for_script_update "$file"
+done
+

+ 0 - 0
scripts/maint/pre-commit.git-hook → scripts/git/pre-commit.git-hook


+ 0 - 0
scripts/maint/pre-push.git-hook → scripts/git/pre-push.git-hook