Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#29532: Update git pre-push hook so that only upstream branches can get pushed to origin #717

Closed
wants to merge 7 commits into from

Conversation

Labels
None yet
Projects
None yet
3 participants
@rl1987
Copy link
Contributor

@rl1987 rl1987 commented Feb 20, 2019

https://trac.torproject.org/projects/tor/ticket/29532

@rl1987 rl1987 force-pushed the feature29532 branch 2 times, most recently from 15b39b0 to 30f669c Feb 20, 2019
scripts/maint/pre-push.git-hook Outdated Show resolved Hide resolved
scripts/maint/pre-push.git-hook Outdated Show resolved Hide resolved
@@ -52,6 +43,19 @@ do
range="$remote_sha..$local_sha"
fi

if ref_is_upstream_branch "$local_ref" == 0 ||
Copy link
Contributor

@nmathewson nmathewson Feb 20, 2019

Should we be checking local_ref at all, or only remote_ref ?

Copy link
Contributor Author

@rl1987 rl1987 Feb 21, 2019

I suppose we should check both, to cover weird situations of local regular branch being pushed to remote upstream branch, and vice versa?

Copy link
Contributor

@nmathewson nmathewson Feb 21, 2019

In that case, I think we should explicitly check for match; pushing maint-0.3.5 to maint-0.3.4 is as bad as pushing bug12345 to maint-0.3.4.

Copy link
Contributor Author

@rl1987 rl1987 Feb 22, 2019

a94c332 and 59c2615 fixes that.

ref_is_upstream_branch "$remote_ref" == 0
if (ref_is_upstream_branch "$local_ref" == 0 ||
ref_is_upstream_branch "$remote_ref" == 0) &&
"$local_ref" ne "$remote_ref"
Copy link
Contributor

@nmathewson nmathewson Feb 24, 2019

Does this part need to be in [square brackets] ?

Copy link
Contributor Author

@rl1987 rl1987 Feb 25, 2019

Shellcheck does not complain about this, so I think not? Then again I'm really not sure.

Copy link
Contributor Author

@rl1987 rl1987 Mar 2, 2019

On second thought, let's use [...] for consistency with previous code. See e28bbc8.

@torproject-pusher torproject-pusher deleted the branch torproject:master May 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment