Summary
Follow-up to #173. git push --dry-run is a general-purpose flag (works with normal pushes, force pushes, and the new --delete path from #173) but git_push has no way to invoke it. Workflows that want to validate a push (especially a destructive --delete) without actually performing it currently have no MCP path.
Proposed change
Add dry_run: bool = False to GitPush and the git_push handler. When True, append --dry-run to the repo.git.push(...) call regardless of which branch is taken (normal / force / delete / refspec).
dry_run: bool = Field(
False,
description="Show what would be pushed without actually pushing (git push --dry-run). "
"Compatible with all push modes including delete and refspec."
)
No new mutual-exclusion rules — --dry-run is compatible with every existing flag.
Why not delete-only
The review feedback that prompted this suggested dry-run specifically for the delete path, but git push --dry-run is general. Scoping it to delete-only would be artificial and would require a second flag later for normal-push dry-runs.
Acceptance
dry_run=True with normal push → repo.git.push('origin', 'main', '--dry-run')
dry_run=True with delete=True → repo.git.push('origin', '--delete', 'feature', '--dry-run')
dry_run=True with refspec='...' → repo.git.push('origin', '...', '--dry-run')
- One test per push mode confirming
--dry-run is in the call args
- Return value notes that no remote state was modified
Context
Surfaced during PR #174 review; deferred to keep that PR scoped to the original three issues.
Summary
Follow-up to #173.
git push --dry-runis a general-purpose flag (works with normal pushes, force pushes, and the new--deletepath from #173) butgit_pushhas no way to invoke it. Workflows that want to validate a push (especially a destructive--delete) without actually performing it currently have no MCP path.Proposed change
Add
dry_run: bool = FalsetoGitPushand thegit_pushhandler. When True, append--dry-runto therepo.git.push(...)call regardless of which branch is taken (normal / force / delete / refspec).No new mutual-exclusion rules —
--dry-runis compatible with every existing flag.Why not delete-only
The review feedback that prompted this suggested dry-run specifically for the delete path, but
git push --dry-runis general. Scoping it to delete-only would be artificial and would require a second flag later for normal-push dry-runs.Acceptance
dry_run=Truewith normal push →repo.git.push('origin', 'main', '--dry-run')dry_run=Truewithdelete=True→repo.git.push('origin', '--delete', 'feature', '--dry-run')dry_run=Truewithrefspec='...'→repo.git.push('origin', '...', '--dry-run')--dry-runis in the call argsContext
Surfaced during PR #174 review; deferred to keep that PR scoped to the original three issues.