We have some great git hooks, but they are going to get out of date.
We don't want to manually copy updates to our repositories: that's a security risk.
But it would be great if we had a post-merge (post pull) hook that logged an obvious message when the hooks in .git are different from the hooks in master's scripts/maint.
For bonus points: log a diff between the .git hooks and the scripts/maint hooks.
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Child items ...
Show closed items
Linked items 0
Link issues together to show that they're related.
Learn more.
I've added a question and noted another issue. The issue makes me worry that maybe this script hasn't been tested: please test it to make sure it works before putting it into needs_review again?
Hello, sorry about that. I fixed the issues and opened a new pull request to clean up a git history and resolve a merge conflict: https://github.com/torproject/tor/pull/780
It works now:
vagrant@stretch:~/tor$ cp scripts/git/post-merge.git-hook .git/hooks/post-merge vagrant@stretch:~/tor$ git rev-parse --abbrev-ref HEADticket29588_2vagrant@stretch:~/tor$ echo "###" >> .git/hooks/post-merge vagrant@stretch:~/tor$ git reset --hard HEAD~2HEAD is now at 5f253f6a4 Iterate over contents of scripts/git with check_for_script_update functionvagrant@stretch:~/tor$ git pullUpdating 5f253f6a4..0befdb8a3Fast-forward scripts/git/post-merge.git-hook | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)ATTENTION: post-merge hook has changed:===============================--- /home/vagrant/tor/.git/hooks/post-merge 2019-03-10 16:45:14.000000000 +0000+++ /home/vagrant/tor/scripts/git/post-merge.git-hook 2019-03-10 16:45:36.000000000 +0000@@ -43,4 +43,3 @@ check_for_script_update "$file" done-###ATTENTION: /home/vagrant/tor/scripts/git/post-merge.git-hook has changed:diff --git a/scripts/git/post-merge.git-hook b/scripts/git/post-merge.git-hookindex ed0e16279..176b7c9bb 100755--- a/scripts/git/post-merge.git-hook+++ b/scripts/git/post-merge.git-hook@@ -20,7 +20,7 @@ check_for_diffs() { then echo "ATTENTION: $1 hook has changed:" echo "==============================="- diff "$installed" "$latest"+ diff -u "$installed" "$latest" fi fi }@@ -31,7 +31,7 @@ check_for_script_update() { if ! git diff ORIG_HEAD HEAD --exit-code -- "$fullpath" >/dev/null then echo "ATTENTION: $1 has changed:"- git diff ORIG_HEAD HEAD -- "$fullpath"+ git --no-pager diff ORIG_HEAD HEAD -- "$fullpath" fi }