Repository navigation
fix: stop retrying mirror pushes rejected by server policy - #264
Merged
Merged
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
vincentkoc
marked this pull request as ready for review
November 20, 2026 04:07
vincentkoc
force-pushed
the
fix/mirror-push-rejections
branch
from
November 20, 2026 04:12
c9b1d16 to
4b543bb
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 tidygit diff --exit-code -- go.mod go.sumGOWORK=off go vet ./...GOWORK=off go test -count=1 ./...git diff --check4b543bbaf828f6de94416b3153331f19a1c1e044545c129d89ed2a3f7b3a2d3c551c01c12f66c2c7