bug(git-gate): force push not forwarded to upstream #233
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
When a client force-pushes through git-gate, the hook builds a plain refspec (
$new:$ref) when forwarding to the upstream. The upstream rejects it as a non-fast-forward because the+force prefix is missing.Root cause
git_gate_render_hook()inbot_bottle/git_gate.pyalways constructs the refspec as$new:$reffor non-delete pushes. It never checks whether$oldis an ancestor of$new, so force pushes are indistinguishable from regular pushes in the forwarded command.Expected behaviour
When
$old != $zeroand$newis not a descendant of$old(git merge-base --is-ancestor $old $newfails), the gate should forward+$new:$refso the upstream accepts the force push.Steps to reproduce
Noted while trying to push the rebased branch for PR #211.