]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
pre-push.git-hook: Allow fixup and squash commits when pushing to non-upstream branches
authorrl1987 <rl1987@sdf.lonestar.org>
Wed, 1 May 2019 09:41:49 +0000 (12:41 +0300)
committerrl1987 <rl1987@sdf.lonestar.org>
Wed, 1 May 2019 11:01:30 +0000 (14:01 +0300)
scripts/git/pre-push.git-hook

index 740180d6f6a7c64fcd8942b351d9b579ac1ed35c..238541d9f0cfb0d8ffc3d0e73b8d36a12726f6ee 100755 (executable)
@@ -16,16 +16,6 @@ echo "Running pre-push hook"
 
 z40=0000000000000000000000000000000000000000
 
-remote="$1"
-
-ref_is_upstream_branch() {
-        if [ "$1" == "refs/heads/master" ] ||
-                [[ "$1" == refs/heads/release-* ]] ||
-                [[ "$1" == refs/heads/maint-* ]]
-        then
-                return 1
-        fi
-}
 
 workdir=$(git rev-parse --show-toplevel)
 if [ -x "$workdir/.git/hooks/pre-commit" ]; then
@@ -40,6 +30,24 @@ if [ -e scripts/maint/practracker/practracker.py ]; then
   fi
 fi
 
+remote="$1"
+remote_loc="$2"
+
+if [[ "$remote_loc" != *github.com/torproject/tor.git ]] &&
+   [[ "$remote_loc" != *torproject.org/tor.git ]]; then
+  echo "Not pushing to upstream - refraining from further checks"
+  exit 0
+fi
+
+ref_is_upstream_branch() {
+        if [ "$1" == "refs/heads/master" ] ||
+                [[ "$1" == refs/heads/release-* ]] ||
+                [[ "$1" == refs/heads/maint-* ]]
+        then
+                return 1
+        fi
+}
+
 # shellcheck disable=SC2034
 while read -r local_ref local_sha remote_ref remote_sha
 do