Skip to content

feat(git): fish-style abbreviation for branch and worktree names - #614

Merged
sirmalloc merged 4 commits into
sirmalloc:mainfrom
axisrow:feat/fish-style-branch-worktree
Oct 26, 2026
Merged

sirmalloc merged 4 commits into
sirmalloc:mainfrom
axisrow:feat/fish-style-branch-worktree

Conversation

@axisrow

@axisrow axisrow commented Sep 27, 2026

Copy link
Copy Markdown
Contributor

Closes #613

Problem

Branch and worktree names render at full length, so a status line carrying ⎇ fix/np/story-123 𖠰 dir/wt spends a lot of width on segments that mostly serve as a prefix. The Current Working Dir widget already has a fish-style mode that collapses path segments, but the git name widgets have no equivalent — and their default rendering is inconsistent with a fish-style cwd next to them.

Fix

Adds a per-widget fish-style mode to both Git Branch and Git Worktree (off by default, editor keybind (f)ish style, stored as metadata.fishStyle):

  • every name segment but the last collapses to its first character: main → m, feature/worktree → f/worktree, fix/np/story → f/p/story, worktree dir/wt → d/wt;
  • the TUI preview and the editor modifier text reflect the mode;
  • the repo link keeps the full branch name in the URL — only the visible label is abbreviated;
  • maxWidth still applies on top of the abbreviated text.

Verification

  • New tests in GitBranch.test.ts (plain and slashed branches, editor modifier + keybind) and GitWorktree.test.ts (main and nested worktrees, editor modifier + keybind).
  • Full suite: 2364 tests pass; bun run lint clean.
  • Live check against a real build: line renders ⎇ m 𖠰 m with both toggles enabled, ⎇ f/git-branch-fish-style on a long-running branch name.

🤖 Generated with Claude Code

@eric-engberg

Copy link
Copy Markdown
Contributor

Heads up: GitBranch.ts changed under this PR in v2.2.31. #667 made the preview show the max width, and #679 (both mine) made a detached HEAD show its commit, so the branch can now be null, with the commit shown as (sha). Abbreviating (abc1234) would need care. I'm happy to help resolve the conflicts if you'd like.

axisrow and others added 2 commits October 11, 2026 22:57
Add a fishStyle metadata option (editor keybind (f)) to Git Branch:
every branch segment but the last collapses to its first character,
so 'main' renders as 'm' and 'fix/np/story' as 'f/p/story'. Mirrors
the existing fish-style mode of Current Working Dir. Link targets
keep the full branch name; the TUI preview reflects the mode.

Co-Authored-By: Claude Code <noreply@anthropic.com>
Same fishStyle option as Git Branch (editor keybind (f)): every
worktree name segment but the last collapses to its first character,
so 'main' renders as 'm' and 'dir/wt' as 'd/wt'.

Co-Authored-By: Claude Code <noreply@anthropic.com>
@axisrow
axisrow force-pushed the feat/fish-style-branch-worktree branch from 8e82bef to 93d77a1 Compare October 11, 2026 15:07
@axisrow

axisrow commented Oct 11, 2026

Copy link
Copy Markdown
Contributor Author

Thanks for the heads-up! The branch is rebased onto v2.2.32 now — both #667's max-width preview and #679's detached-HEAD change are integrated. The (sha) rendering is deliberately not fish-abbreviated: abbreviateBranch only runs on real branch names. Feel free to review if you'd like.

@sirmalloc
sirmalloc merged commit b11b429 into sirmalloc:main Oct 26, 2026
3 checks passed
axisrow added a commit to axisrow/ccstatusline that referenced this pull request Oct 27, 2026
…it names, sirmalloc#717 claude-settings test isolation, sirmalloc#705 jj detached HEAD, sirmalloc#703 hooks save warning, sirmalloc#700 dev reload, sirmalloc#698 renderer merge ends at hidden widget, sirmalloc#697 block reset timer under-limit hide, sirmalloc#745 dev-deps bumps

Conflict policy: upstream infra wins, fork features ported on top (fork-only
src/daemon/, src/widgets/editors/*, parity fixtures and fork widgets kept).
Notable joins: sirmalloc#703 returns SkippedWidgetHooks through the fork's
saveSettingsTo wrapper; sirmalloc#697 keeps the fork's zero hide state alongside
upstream's under-limit state; sirmalloc#698 replaces the fork's merge-glue palette
semantics with upstream's merge-ends-at-unmerged-empty-widget rule;
dev-reload (ctrl+r) composes with the fork's first-run preset picker.

Co-Authored-By: Claude Code <noreply@anthropic.com>
pcvelz added a commit to pcvelz/ccstatusline-usage that referenced this pull request Oct 29, 2026
Upstream: Extra Usage Limit widget (sirmalloc#756), live widget preview while picking (sirmalloc#755), Fast Mode widget (sirmalloc#754), transcript block fallback fixes (sirmalloc#752), editor keys on a global install (sirmalloc#751), git cache TTL (sirmalloc#750), npx cached copy skip (sirmalloc#749), Block Usage hide at 100% (sirmalloc#747), Block Reset Timer hide until 100% (sirmalloc#697), fish-style branch abbreviation (sirmalloc#614), jj detached HEAD (sirmalloc#705), hooks save warning (sirmalloc#703), dev reload (sirmalloc#700), merge ends at a hidden widget (sirmalloc#698), Block Forecast and Block Limit Timer widgets (sirmalloc#699), contributor guide (sirmalloc#706), POSIX path case fix (sirmalloc#707), whitespace-distinct conflict filenames (sirmalloc#709), Quick Start reorder (sirmalloc#715), bunx launch guidance (sirmalloc#714), jj diff summary counts (sirmalloc#711), powerline manual separators (sirmalloc#713), keychain credential by account (sirmalloc#532), Keychain probe timeout (sirmalloc#760), usage cache scoped per CLAUDE_CONFIG_DIR (sirmalloc#266), test isolation (sirmalloc#717, sirmalloc#753), dev-dependency bumps (sirmalloc#745)

Conflicts resolved per the standard-resolution table; fork deletions re-applied.

Hand edits outside conflicts:
- src/utils/global-command-resolution.ts: fork-rename (ccstatusline@ -> ccstatusline-usage@ in upstream's new bunx pattern)
- src/utils/__tests__/global-package-manager.test.ts: fork-rename (package dir ccstatusline-usage in upstream's new tests)
- src/utils/usage-fetch.ts: compat fix - cacheUsageData gained a fetchedAtMs arg (upstream sirmalloc#266); adapted the fork-only fetchFreshUsageData call site
- src/utils/__tests__/usage-fetch.test.ts: compat fixes - cache/lock now hashed per CLAUDE_CONFIG_DIR (usageFilePath helper) in four fork tests; upstream fableUsage renamed to fork's weeklyFableUsage; seedUsageCache takes TokenHome
- src/utils/__tests__/usage-prefetch.test.ts: compat fix - mockFetchUsageData renamed to upstream's mockFetchUsage in cleanly-merged tests
- README.md: took upstream's Quick Start move (sirmalloc#715) and dropped the fork's old copy; fork-rename of its ccstatusline@ specifiers; links to fork-deleted docs (docs/USAGE.md, docs/WINDOWS.md) replaced with the fork's inline text
- CONTRIBUTING.md: links to the fork-deleted docs/DEVELOPMENT.md pointed at the README Development section
- docs/test-retirements.md: ledger entries for the 12 upstream test renames (sirmalloc#697, sirmalloc#698, sirmalloc#700, sirmalloc#705, sirmalloc#713, sirmalloc#760)
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.

feat(git): fish-style abbreviation for branch and worktree names

3 participants