feat(sync): add --branch flag to sync from a specific branch#29
Merged
Conversation
Lets `stag sync --branch <name>` pull config from a non-default branch, useful for testing standards changes before merging. The branch feeds the existing ?ref= GitHub plumbing via a new resolveBranch helper. An explicit --branch always fetches: the cache is keyed by owner/repo (not branch), so the freshness short-circuit is skipped to avoid serving default-branch content. --branch is rejected for multi-source configs, which target multiple repos.
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
Adds
stag sync --branch <name>to sync the config from a specific branch instead of the repository's default branch. Handy for testing standards changes on a branch before merging them to the default branch.Why
runSynccurrently always resolves the branch viaGetDefaultBranch, with no way to override it. The GitHub client already accepts a?ref=<branch>argument onFetchFile/ListDirectory/FileExists- this just wires a flag through to it.How
--branchflag onstag sync, plumbed through a smallresolveBranchhelper (explicit override, else the repo default).--branchalways fetches. The cache is keyed byowner/repo, not by branch, so the cache-freshness short-circuit is skipped when--branchis set - otherwise a fresh default-branch cache would silently serve the wrong content for a branch request.--branchis rejected for multi-source configurations, since a single branch can't meaningfully apply across multiple source repos.