feat: add optional workdir suffix for worktree disambiguation#2
Merged
Conversation
Adds CFG_SHOW_WORKDIR, CFG_WORKDIR_STYLE (full/relative/basename/worktree), and CFG_WORKDIR_MAX_LEN to both statusline.sh and statusline.ps1. Renders as "repo ▸ workdir" on line 1 with left-truncation that preserves the worktree-specific tail. The worktree style (default) shows the cwd basename only when it differs from the repo name — single-worktree users see no change. Adds test/test-workdir.sh (11 tests) exercising all four styles, the disabled flag, and truncation. Updates README + CHANGELOG. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
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.
Summary
CFG_SHOW_WORKDIR,CFG_WORKDIR_STYLE,CFG_WORKDIR_MAX_LENin bothstatusline.shandstatusline.ps1(parity across shells).repo ▸ workdirin dim text when the workdir differs; the defaultworktreestyle is a no-op for single-worktree users.full,relative(~-prefixed),basename,worktree(basename only when it differs from repo name — the user's case).…so the worktree-specific tail always survives:…/code-koala-worktrees/p01-numbered-diffs.Motivation: running many git worktrees off the same repo makes
location_name(repo name) identical across them. The existing statusline gave no indication which worktree you were in.Test plan
test/test-workdir.sh— 11 tests covering all four styles, the disabled flag, single-worktree no-op, linked-worktree basename surfacing, and left-truncation preserving the tail.test-statusline-v2.sh(11),test-hooks.sh(7),test-brif-pane.sh(20). 49 tests total pass.full/relative/basename/worktreestyles, home-dir~substitution works even when\$env:USERPROFILEand JSON-supplied cwd use different slash conventions.Non-changes
worktreestyle is a simple basename-vs-repo-name comparison).🤖 Generated with Claude Code