fix(git-gate): forward force push as +refspec to upstream #234
Reference in New Issue
Block a user
Delete Branch "fix/gate-force-push"
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?
Closes #233.
Summary
When a client does
git push --force, the gate's pre-receive hook was always building the forwarded refspec as$new:$ref. The upstream rejected this as a non-fast-forward because the+force prefix was missing.Fix: detect force pushes via
git merge-base --is-ancestor $old $newwhen$old != $zero. If the old tip is not an ancestor of the new tip, forward+$new:$ref.Changed file: bot_bottle/git_gate.py