Skip to content

Wire git worktree operations into Dispatcher/WorkflowRunner #175

Description

@zeroklaw

Background

From the review in #165: the entire git module (src/git.rs) has zero production callers. All 7 of its exported functions (clone_repo, pull_repo, create_worktree, remove_worktree, has_uncommitted_changes, sanitize_branch_name, build_clone_url) are only used in integration tests. The ~330 lines of production code and the git2 dependency exist solely for this unused module.

However, the module is clearly planned infrastructure — the module-level doc comment describes the full lifecycle (clone → pull → worktree → cleanup), GitConfig already exists in workflow.rs, and the WorkflowRunner references workflow.git.clone and workflow.git.worktree in its instructions-building logic. The actual git operations were never wired into the runner/dispatcher.

Task

Wire up the git module's worktree operations into the Dispatcher/WorkflowRunner so that when a workflow's GitConfig specifies clone and worktree settings, the runner actually performs the git clone, worktree creation/checkout, and cleanup as part of the workflow execution lifecycle.

This involves:

  1. Calling build_clone_url and clone_repo/pull_repo when a dispatch arrives and workflow.git.clone is configured
  2. Creating a worktree via create_worktree before running the workflow command
  3. Running the workflow command inside the worktree directory
  4. Cleaning up via remove_worktree after the workflow completes (success or failure)
  5. Using has_uncommitted_changes for status checks as appropriate

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions