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:
- Calling
build_clone_url and clone_repo/pull_repo when a dispatch arrives and workflow.git.clone is configured
- Creating a worktree via
create_worktree before running the workflow command
- Running the workflow command inside the worktree directory
- Cleaning up via
remove_worktree after the workflow completes (success or failure)
- Using
has_uncommitted_changes for status checks as appropriate
Background
From the review in #165: the entire
gitmodule (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 thegit2dependency 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),
GitConfigalready exists inworkflow.rs, and theWorkflowRunnerreferencesworkflow.git.cloneandworkflow.git.worktreein its instructions-building logic. The actual git operations were never wired into the runner/dispatcher.Task
Wire up the
gitmodule's worktree operations into theDispatcher/WorkflowRunnerso that when a workflow'sGitConfigspecifiescloneandworktreesettings, the runner actually performs the git clone, worktree creation/checkout, and cleanup as part of the workflow execution lifecycle.This involves:
build_clone_urlandclone_repo/pull_repowhen a dispatch arrives andworkflow.git.cloneis configuredcreate_worktreebefore running the workflow commandremove_worktreeafter the workflow completes (success or failure)has_uncommitted_changesfor status checks as appropriate