agentws: check out --branch from origin when it exists #17

Merged
benvin merged 2 commits from benvin/agentws-branch-checkout into main 2026-09-19 16:36:46 +10:00

2 Commits

Author SHA1 Message Date
unkin-agent 1b90e60aeb Run go test once per module in pre-commit
ci/woodpecker/pr/build Pipeline was successful
ci/woodpecker/pr/pre-commit Pipeline was successful
ci/woodpecker/pr/test Pipeline was successful
The go-unit-tests hook caps every package at 30s and re-runs the whole module
once per file batch, so the git-fixture tests in cmd/agentws timed out as soon
as they grew.

- Replace go-unit-tests with a module-level `go test ./...` local hook
2026-09-19 16:20:36 +10:00
unkin-agent 7510187243 agentws: check out --branch from origin when it exists
ci/woodpecker/pr/build Pipeline was successful
ci/woodpecker/pr/test Pipeline was successful
ci/woodpecker/pr/pre-commit Pipeline failed
`agentws new --branch` always forked from the base branch, so a worktree for a
branch that already existed on origin started at the base's HEAD with none of
the branch's commits, and callers had to reset --hard afterwards to recover.

- Check out an existing origin/<branch> and set the branch to track it
- Fast-forward a stale local branch onto origin, keeping unpushed commits
- Fork from --from or the remote default only when origin lacks the branch
- Name which of the two paths was taken in the command's output
- Ignore --from, with a note, when the branch is already on origin
2026-09-19 16:11:59 +10:00