Skip to content

Pluggable git push target via GitPushPolicy (1.11.0) - #16

Merged
gmpassos merged 1 commit into
masterfrom
feat/pluggable-push-policy
Jul 2, 2026
Merged

Pluggable git push target via GitPushPolicy (1.11.0)#16
gmpassos merged 1 commit into
masterfrom
feat/pluggable-push-policy

Conversation

@gmpassos

@gmpassos gmpassos commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

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.

  • New GitPushPolicy (injected via GitProvider(pushPolicy:)); the GitSynchronizer consults 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).
  • Diverged origins still raise ConflictDetectedException — a push never force-writes.

This lets omnyshell protect main/master and 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.
  • New tests: a non-protected branch is pushed to itself (created on origin); a policy-protected branch is routed to a feature branch; consecutive pushes off a protected branch create a feature branch then fast-forward it.
  • Full suite green (238 tests).

🤖 Generated with Claude Code

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>
@gmpassos
gmpassos merged commit d1e4ac5 into master Jul 2, 2026
2 checks passed
@gmpassos
gmpassos deleted the feat/pluggable-push-policy branch July 2, 2026 05:08
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