Repository navigation
feat: set the destination default branch to match the source - #18
Merged
Merged
Conversation
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
The destination repository's default branch now follows the source.
repositorycarriesdefault_branch(omitted when the source reports none), so the metadata update that already runs after the refs push sends it along with description and homepage. The branch exists by then because all source branches were pushed first; if GitHub still rejects the update, the repository settings most likely do not allow the token to change them.Why
A destination created with
mainkeptmainas its default even aftermasterarrived from the source, so opening the mirror showed a branch the source does not use. Deleting destination-only branches stays out of scope; this only fixes which existing branch is the default.How tested
TestRunReplicatesIntoDestinationnow serves a source default ofmasterand a destination default ofmain, then asserts the captured metadata update carriesmaster, proving the value travels from the source read through preflight into the update that follows the push.TestSyncMetadataSetsDestinationDefaultBranchkeeps the narrow unit check on the request body.go test -race -count=1 ./...: 49 tests pass, including the offline entrypoint suite.gofmt -l .clean,GOTOOLCHAIN=go1.27.3 go vet ./...clean,go buildok,git diff --checkclean.Known limit: changing a default branch needs repository administration and can be restricted by rulesets, so a failure is reported as an error after the refs push, leaving a partial replication. Branch protections are neither copied nor bypassed.
Out of scope
Deleting destination-only branches, branch protection, visibility and any other repository setting. A dry run still writes nothing.
Closes #17