summaryrefslogtreecommitdiff
path: root/scripts/git
diff options
context:
space:
mode:
authorrl1987 <rl1987@sdf.lonestar.org>2019-05-11 18:58:14 +0300
committerrl1987 <rl1987@sdf.lonestar.org>2019-05-11 18:58:14 +0300
commit6f1527f88871d16c4edf83f56ed5cdde1f6d2b82 (patch)
treed96f6f0c61b4375c1bb2c0626206cefb2ef18d4f /scripts/git
parentd91deeee45c3433cc7dcaf1e67a84692420db870 (diff)
downloadtor-6f1527f88871d16c4edf83f56ed5cdde1f6d2b82.tar.gz
tor-6f1527f88871d16c4edf83f56ed5cdde1f6d2b82.zip
pre-push.git-hook: Check remote name to see if it's upstream
Diffstat (limited to 'scripts/git')
-rwxr-xr-xscripts/git/pre-push.git-hook6
1 files changed, 4 insertions, 2 deletions
diff --git a/scripts/git/pre-push.git-hook b/scripts/git/pre-push.git-hook
index 238541d9f0..00e048029e 100755
--- a/scripts/git/pre-push.git-hook
+++ b/scripts/git/pre-push.git-hook
@@ -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