Skip to content

feat: complete template variable redesign follow-ups - #1663

Merged
max-sixty merged 1 commit into
mainfrom
template-vars
Mar 22, 2026
Merged

max-sixty merged 1 commit into
mainfrom
template-vars

Conversation

@max-sixty

Copy link
Copy Markdown
Owner

Follow-up fixes and documentation for the template variable redesign (#1655, #1660).

Code fixes:

  • commit derivation now uses rev-parse <branch> instead of rev-parse HEAD, so {{ commit }} follows the Active branch
  • base / base_worktree_path now available in post-switch for existing switches (previously only creates)
  • post-remove {{ target }} now correctly resolves to the destination branch, not the removed branch

Documentation:

  • Restructured template variable table — Active vars grouped first, directional vars second, repo-level vars last
  • Added arrive/depart table explaining what bare vars, base, and target point to per operation
  • Documented when cwd differs from worktree_path (pre-switch existing, post-remove, post-merge with removal)

Tests: 4 new integration tests for directional var semantics.

Ref #1633

This was written by Claude Code on behalf of @max-sixty

- commit derivation: use `rev-parse <branch>` instead of `rev-parse HEAD`
  so {{ commit }} follows the Active branch, not the discovery path
- base vars in post-switch: capture source branch/path before switch and
  provide as {{ base }} / {{ base_worktree_path }} for existing switches
- post-remove target fix: look up target branch from worktree at main_path
  instead of using the CommandContext branch (which is the removed branch)
- docs: restructured template variable table with Active model explanation,
  arrive/depart table, cwd vs worktree_path differences
- tests: 4 new tests for directional var semantics (pre-switch destination,
  post-remove target, post-switch base, cwd existence)

Co-Authored-By: Claude <[email protected]>
@max-sixty
max-sixty merged commit af8a602 into main Mar 22, 2026
23 checks passed
@max-sixty
max-sixty deleted the template-vars branch March 22, 2026 23:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants