Compare commits

..

3 Commits

Author SHA1 Message Date
didericis-codex 67773b3170 docs(prd): add gitleaks allow supervision
lint / lint (push) Successful in 1m39s
test / unit (pull_request) Successful in 34s
test / integration (pull_request) Successful in 18s
2026-06-11 02:27:31 +00:00
didericis-codex fe679271fa Supervise gitleaks inline allow exceptions 2026-06-11 02:27:31 +00:00
didericis-claude b00b0ba4aa fix(git-gate): forward force push as +refspec to upstream
test / unit (pull_request) Successful in 38s
test / integration (pull_request) Successful in 22s
lint / lint (push) Successful in 1m47s
test / unit (push) Successful in 34s
test / integration (push) Successful in 20s
Update Quality Badges / update-badges (push) Successful in 1m21s
When $old != zero and $new is not a descendant of $old (detected via
git merge-base --is-ancestor), the hook now forwards +$new:$ref so the
upstream accepts the force push instead of rejecting it as a
non-fast-forward.

Closes #233
2026-06-11 02:17:27 +00:00
2 changed files with 9 additions and 0 deletions
+2
View File
@@ -461,6 +461,8 @@ while IFS=' ' read -r old new ref; do
[ -z "$ref" ] && continue [ -z "$ref" ] && continue
if [ "$new" = "$zero" ]; then if [ "$new" = "$zero" ]; then
refspec=":$ref" refspec=":$ref"
elif [ "$old" != "$zero" ] && ! git merge-base --is-ancestor "$old" "$new" 2>/dev/null; then
refspec="+$new:$ref"
else else
refspec="$new:$ref" refspec="$new:$ref"
fi fi
+7
View File
@@ -181,6 +181,13 @@ class TestHookRender(unittest.TestCase):
self.assertIn("BatchMode=yes", hook) self.assertIn("BatchMode=yes", hook)
self.assertIn("ConnectTimeout=", hook) self.assertIn("ConnectTimeout=", hook)
def test_force_push_uses_plus_refspec(self):
# A non-fast-forward push (old != zero, new not a descendant of old)
# must forward +$new:$ref so the upstream accepts the force push.
hook = git_gate_render_hook()
self.assertIn('git merge-base --is-ancestor "$old" "$new"', hook)
self.assertIn('refspec="+$new:$ref"', hook)
def test_forward_preserves_push_options(self): def test_forward_preserves_push_options(self):
# Git exposes push options to pre-receive hooks as # Git exposes push options to pre-receive hooks as
# GIT_PUSH_OPTION_COUNT + indexed GIT_PUSH_OPTION_N variables. # GIT_PUSH_OPTION_COUNT + indexed GIT_PUSH_OPTION_N variables.