diff options
author | rl1987 <rl1987@sdf.lonestar.org> | 2019-05-01 12:41:49 +0300 |
---|---|---|
committer | rl1987 <rl1987@sdf.lonestar.org> | 2019-05-01 14:01:30 +0300 |
commit | d91deeee45c3433cc7dcaf1e67a84692420db870 (patch) | |
tree | f88daabe5805d19752779a504ce4497bd9c9fc5c /scripts/git/pre-push.git-hook | |
parent | 39bd10dca65fb4007a3da2a15323e6a8bebfd0aa (diff) | |
download | tor-d91deeee45c3433cc7dcaf1e67a84692420db870.tar.gz tor-d91deeee45c3433cc7dcaf1e67a84692420db870.zip |
pre-push.git-hook: Allow fixup and squash commits when pushing to non-upstream branches
Diffstat (limited to 'scripts/git/pre-push.git-hook')
-rwxr-xr-x | scripts/git/pre-push.git-hook | 28 |
1 files changed, 18 insertions, 10 deletions
diff --git a/scripts/git/pre-push.git-hook b/scripts/git/pre-push.git-hook index 740180d6f6..238541d9f0 100755 --- a/scripts/git/pre-push.git-hook +++ b/scripts/git/pre-push.git-hook @@ -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 |