Pluggable git push target via GitPushPolicy (1.11.0) - #16
Merged
Conversation
A push now consults an injectable GitPushPolicy to decide whether the checked-out branch is published to itself or to a fresh feature branch (BranchNamingStrategy). DefaultGitPushPolicy protects main/master and pushes every other branch directly; embedders pass extra protectedBranches or a custom policy via GitProvider(pushPolicy:). A protected branch is never moved by a push; a branch absent from the origin is created by the direct push; diverged origins still raise ConflictDetectedException (never force-write). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.
Summary
Makes the git-drive push target pluggable so an embedder can control which branches are pushed to directly vs published to a fresh feature branch.
GitPushPolicy(injected viaGitProvider(pushPolicy:)); theGitSynchronizerconsults it on every push.DefaultGitPushPolicy(protectedBranches: {'main','master'}): protected branches → a fresh feature branch (never moved by a push); every other branch → pushed to directly (created on the origin if absent).ConflictDetectedException— a push never force-writes.This lets omnyshell protect
main/masterand the branch a drive was mounted to track, while a working branch the node created is pushed to as-is.Test plan
dart analyze+dart format --set-exit-if-changed .— clean.🤖 Generated with Claude Code