Repository navigation
feat: complete template variable redesign follow-ups - #1663
Merged
Merged
Conversation
- 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]>
worktrunk-bot
approved these changes
Mar 22, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up fixes and documentation for the template variable redesign (#1655, #1660).
Code fixes:
commitderivation now usesrev-parse <branch>instead ofrev-parse HEAD, so{{ commit }}follows the Active branchbase/base_worktree_pathnow available in post-switch for existing switches (previously only creates){{ target }}now correctly resolves to the destination branch, not the removed branchDocumentation:
base, andtargetpoint to per operationcwddiffers fromworktree_path(pre-switch existing, post-remove, post-merge with removal)Tests: 4 new integration tests for directional var semantics.
Ref #1633