Skip to content

fix: stop retrying mirror pushes rejected by server policy - #264

Merged
vincentkoc merged 1 commit into
mainfrom
fix/mirror-push-rejections
Nov 20, 2026
Merged

vincentkoc merged 1 commit into
mainfrom
fix/mirror-push-rejections

Conversation

@vincentkoc

@vincentkoc vincentkoc commented Nov 20, 2026 •

Copy link
Copy Markdown
Member

What Problem This Solves

A mirror push rejected by server policy triggers a sync/rebase attempt and a second push. Git's generic failure summary is being mistaken for branch divergence. This affects normal branch pushes and both atomic snapshot push variants.

User Impact

Server-policy and authentication rejections return immediately with the original push error. A genuine non-fast-forward or fetch-first rejection still triggers the existing sync and retry behavior.

Why This Change Was Made

Only explicit divergence messages justify updating local history and retrying. The generic “failed to push some refs” summary accompanies other failures too.

Evidence

A local rejecting remote received two push attempts from each of the three push variants before the fix, and exactly one afterward. Portable classification cases cover hook, authentication, and generic failures alongside both recognized divergence messages. Existing real-divergence tests still pass for both snapshot routes, including tag retargeting.

Local library validation passed. Independent native review and re-review after a changelog-only rebase found no P0–P3 issues. The focused rejection and divergence tests passed again after rebasing. The server-hook fixture is POSIX-only; Windows retains the portable classifier tests. Classification still uses Git's existing text messages.

Validation details
  • GOWORK=off go test -count=1 ./mirror -run '^(TestNonFastForwardRequiresDivergence|TestPushDoesNotRetryServerRejection|TestPushSnapshotRebasesAndRetargetsTag)$'
  • GOWORK=off go mod tidy
  • git diff --exit-code -- go.mod go.sum
  • GOWORK=off go vet ./...
  • GOWORK=off go test -count=1 ./...
  • git diff --check
  • Reviewed candidate: 4b543bbaf828f6de94416b3153331f19a1c1e044
  • Base: 545c129d89ed2a3f7b3a2d3c551c01c12f66c2c7

@clawsweeper

clawsweeper Bot commented Nov 20, 2026

Copy link
Copy Markdown

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

@vincentkoc
vincentkoc marked this pull request as ready for review November 20, 2026 04:07
@vincentkoc
vincentkoc force-pushed the fix/mirror-push-rejections branch from c9b1d16 to 4b543bb Compare November 20, 2026 04:12
@vincentkoc
vincentkoc merged commit 9daf8dc into main Nov 20, 2026
8 checks passed
@vincentkoc
vincentkoc deleted the fix/mirror-push-rejections branch November 20, 2026 04:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant