Add Entire Trail Checkout Command · Entire

New entire trail checkout Command

Add a new entire trail checkout command which checks out a specified trail. This requires some trail name, id, or branch; therefore, it should have the --trail parameter or the first argument after "checkout" to specify which trail to check out. The command must operate from within a clone of the repo that the trail belongs to.


PR Details

PR created: PR #1483

I committed only the two feature files (trail_cmd.go and trail_checkout_cmd_test.go) while leaving the unrelated .claude/settings.json out of the commit, as it was already modified at session start and isn't part of this feature. It remains uncommitted in your working tree.

The PR adds entire trail checkout with the --trail/first-arg specifier (number, id, or branch), scoped to the current clone's repo via the origin remote, reusing the existing branch-switch helper and the extracted resolveTrailBySelector.


Commit Messages

Co-Authored-By: Claude Opus 4.8 noreply@anthropic.com
Entire-Checkpoint: d632a529781e+240/-22


Review Updates

Pushed to PR #1483. Addressed all three findings from the Cursor and Copilot reviews:

  1. Empty-branch error misidentifies trail (Cursor + Copilot): Changed the error to use describeTrailRef(found) instead of found.Title, so a numbered trail with no title now reads trail #575 has no branch to check out rather than trail "" has no branch to check out.

  2. Silent exit on declined fetch (Copilot): Adjusted error handling so that when the user declines fetching a remote-only branch, the command now prints an explicit Checkout of branch X cancelled. message instead of leaving the earlier "Checking out …" line ambiguous.

  3. Parallel subtest loop-variable capture (Copilot): Copied the input into a local variable before taking its address, removing any ambiguity regarding loop semantics under Go 1.26. This change avoids issues flagged by the copyloopvar linter.

Additional Information


Follow-Up Commit

Co-Authored-By: Claude Opus 4.8 noreply@anthropic.com
Entire-Checkpoint: 5aba9c537cea+14/-6