diff options
author | George Kadianakis <desnacked@riseup.net> | 2019-03-13 16:07:19 +0200 |
---|---|---|
committer | George Kadianakis <desnacked@riseup.net> | 2019-03-13 16:07:19 +0200 |
commit | 26b0d95397987a4458cc8afc4142b70f9f797870 (patch) | |
tree | 44e0ca6765e869c3cd7635fe7604f91f31afe79c | |
parent | 58fd864a85fc58650ac7c7c48a68f7a49de38260 (diff) | |
parent | 0befdb8a35f26a1423107d181ecf08c48fb05229 (diff) | |
download | tor-26b0d95397987a4458cc8afc4142b70f9f797870.tar.gz tor-26b0d95397987a4458cc8afc4142b70f9f797870.zip |
Merge branch 'tor-github/pr/780'
-rw-r--r-- | changes/ticket29588 | 4 | ||||
-rwxr-xr-x | scripts/git/git-merge-forward.sh (renamed from scripts/maint/git-merge-forward.sh) | 0 | ||||
-rwxr-xr-x | scripts/git/git-pull-all.sh (renamed from scripts/maint/git-pull-all.sh) | 0 | ||||
-rwxr-xr-x | scripts/git/git-push-all.sh (renamed from scripts/maint/git-push-all.sh) | 0 | ||||
-rwxr-xr-x | scripts/git/post-merge.git-hook | 45 | ||||
-rwxr-xr-x | scripts/git/pre-commit.git-hook (renamed from scripts/maint/pre-commit.git-hook) | 0 | ||||
-rwxr-xr-x | scripts/git/pre-push.git-hook (renamed from scripts/maint/pre-push.git-hook) | 0 |
7 files changed, 49 insertions, 0 deletions
diff --git a/changes/ticket29588 b/changes/ticket29588 new file mode 100644 index 0000000000..c81bccb00d --- /dev/null +++ b/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. diff --git a/scripts/maint/git-merge-forward.sh b/scripts/git/git-merge-forward.sh index 67af7e98bf..67af7e98bf 100755 --- a/scripts/maint/git-merge-forward.sh +++ b/scripts/git/git-merge-forward.sh diff --git a/scripts/maint/git-pull-all.sh b/scripts/git/git-pull-all.sh index 0a4898a111..0a4898a111 100755 --- a/scripts/maint/git-pull-all.sh +++ b/scripts/git/git-pull-all.sh diff --git a/scripts/maint/git-push-all.sh b/scripts/git/git-push-all.sh index 0ce951d4bd..0ce951d4bd 100755 --- a/scripts/maint/git-push-all.sh +++ b/scripts/git/git-push-all.sh diff --git a/scripts/git/post-merge.git-hook b/scripts/git/post-merge.git-hook new file mode 100755 index 0000000000..176b7c9bbd --- /dev/null +++ b/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 + diff --git a/scripts/maint/pre-commit.git-hook b/scripts/git/pre-commit.git-hook index 65fa99f4c4..65fa99f4c4 100755 --- a/scripts/maint/pre-commit.git-hook +++ b/scripts/git/pre-commit.git-hook diff --git a/scripts/maint/pre-push.git-hook b/scripts/git/pre-push.git-hook index e7a72efa08..e7a72efa08 100755 --- a/scripts/maint/pre-push.git-hook +++ b/scripts/git/pre-push.git-hook |