]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
pre-push.git-hook: Check remote name to see if it's upstream
authorrl1987 <rl1987@sdf.lonestar.org>
Sat, 11 May 2019 15:58:14 +0000 (18:58 +0300)
committerrl1987 <rl1987@sdf.lonestar.org>
Sat, 11 May 2019 15:58:14 +0000 (18:58 +0300)
scripts/git/pre-push.git-hook

index 238541d9f0cfb0d8ffc3d0e73b8d36a12726f6ee..00e048029e1eb8c46bd7899a1c72c71fc1aae190 100755 (executable)
@@ -16,6 +16,7 @@ echo "Running pre-push hook"
 
 z40=0000000000000000000000000000000000000000
 
+upstream_name=${TOR_UPSTREAM_REMOTE_NAME:-"upstream"}
 
 workdir=$(git rev-parse --show-toplevel)
 if [ -x "$workdir/.git/hooks/pre-commit" ]; then
@@ -33,8 +34,9 @@ fi
 remote="$1"
 remote_loc="$2"
 
-if [[ "$remote_loc" != *github.com/torproject/tor.git ]] &&
-   [[ "$remote_loc" != *torproject.org/tor.git ]]; then
+remote_name=$(git remote --verbose | grep "$2" | awk '{print $1}' | head -n 1)
+
+if [[ "$remote_name" != "$upstream_name" ]]; then
   echo "Not pushing to upstream - refraining from further checks"
   exit 0
 fi