summaryrefslogtreecommitdiff
path: root/internal/executor/container.go
diff options
context:
space:
mode:
authorPeter Stone <thepeterstone@gmail.com>2026-03-24 21:35:12 +0000
committerPeter Stone <thepeterstone@gmail.com>2026-03-24 21:35:12 +0000
commite3954992af63440986bd39cce889e9c62e1a6b92 (patch)
treefc3360d1a4895ad02d105c44947aec98f263b6f7 /internal/executor/container.go
parentbc62c3545bbcf3f9ccc508cdc43ce9ffdb5dfad0 (diff)
feat: clone story branch in ContainerRunner (ADR-007)
- Add BranchName field to task.Task (populated from story at execution time) - Add GetStory to executor Store interface; resolve BranchName from story in both execute() and executeResume() parallel to RepositoryURL resolution - Pass --branch <name> to git clone when BranchName is set; default clone otherwise Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Diffstat (limited to 'internal/executor/container.go')
-rw-r--r--internal/executor/container.go9
1 files changed, 7 insertions, 2 deletions
diff --git a/internal/executor/container.go b/internal/executor/container.go
index d9ed8ef..d270e20 100644
--- a/internal/executor/container.go
+++ b/internal/executor/container.go
@@ -101,8 +101,13 @@ func (r *ContainerRunner) Run(ctx context.Context, t *task.Task, e *storage.Exec
if err := os.Remove(workspace); err != nil {
return fmt.Errorf("removing workspace before clone: %w", err)
}
- r.Logger.Info("cloning repository", "url", repoURL, "workspace", workspace)
- if out, err := r.command(ctx, "git", "clone", repoURL, workspace).CombinedOutput(); err != nil {
+ r.Logger.Info("cloning repository", "url", repoURL, "workspace", workspace, "branch", t.BranchName)
+ cloneArgs := []string{"clone"}
+ if t.BranchName != "" {
+ cloneArgs = append(cloneArgs, "--branch", t.BranchName)
+ }
+ cloneArgs = append(cloneArgs, repoURL, workspace)
+ if out, err := r.command(ctx, "git", cloneArgs...).CombinedOutput(); err != nil {
return fmt.Errorf("git clone failed: %w\n%s", err, string(out))
}
if err = os.Chmod(workspace, 0755); err != nil {