Skip to content

feat(git): add dry_run flag to git_push #176

@MementoRC

Description

@MementoRC

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=Truerepo.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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions