Commit 8a87499
committed
feat(sidebar): show worktrees under their repository
Add an optional sidebar mode that shows linked worktrees nested under their repository in the main repository list so repository switching can stay in the main sidebar instead of requiring the worktree dropdown.
Changes:
- add a secondary Appearance setting to show worktrees in the repository sidebar when worktree support is enabled
- group linked worktrees under their main repository in the sidebar
- synthesize child rows for linked worktrees discovered from `git worktree list` even when those worktrees were never added as repositories
- support linked-only setups by synthesizing sibling worktree rows even when the stored entry is itself a linked worktree instead of the main worktree
- use worktree folder names for child row labels while preserving existing alias styling for saved repository entries
- use the same displayed-title logic for sorting and disambiguation so nested rows sort and label consistently with what the user sees
- preload main-repository worktree state for the sidebar so nested rows and stored linked-worktree branch pills are available on initial render instead of only after opening the worktree dropdown or forcing another sidebar refresh
- refresh parent sidebar rows when linked worktrees are selected so nested rows stay in sync with the active repository view
- surface nested worktree rows from both saved worktree repositories and synthetic virtual rows without duplicating entries already stored in Desktop
- avoid duplicate `Pull all` work for linked worktrees while still including orphan linked worktrees when the main repo is absent from the stored repository list
- route virtual worktree open failures through the normal app error path instead of silently failing
- open synthetic worktree rows transiently instead of persisting them as top-level repositories under `Other`
- keep stored linked-worktree rows on the repository-management context menu while giving synthetic rows a worktree-specific context menu that uses `PopupType.DeleteWorktree`
- persist sidebar worktree metadata in repository state and extract the sidebar-specific state shaping into a dedicated helper to keep `app-store.ts` smaller
- throttle sidebar worktree refreshes during repository indicator updates to reduce repeated `git worktree list` churn
- prune sidebar worktree refresh timestamps when repository lists change so stale cache entries do not accumulate
- tighten TypeScript null/undefined handling in repository and sidebar list code so production webpack builds pass across the full CI matrix
- add and extend unit coverage for grouped rows, synthetic rows, linked-only setups, stored linked-worktree branch labels, and repository-list context menu behavior
Behavioral effect:
Users can opt into seeing and switching linked worktrees directly from the main repository sidebar, including unstored Git worktrees, with branch labels, parent-child grouping, and worktree-aware context menu behavior available without forcing those virtual rows into the saved repository list.
Testing:
- yarn test:unit app/test/unit/repositories-list-grouping-test.ts
- yarn test:unit app/test/unit/repository-list-item-context-menu-test.ts
- yarn lint
- yarn compile:dev
- yarn compile:prod1 parent bce9f0a commit 8a87499
17 files changed
Lines changed: 1497 additions & 101 deletions
File tree
- app
- src
- lib
- git
- stores
- helpers
- models
- ui
- dispatcher
- preferences
- repositories-list
- styles/ui
- test/unit
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
321 | 321 | | |
322 | 322 | | |
323 | 323 | | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
324 | 327 | | |
325 | 328 | | |
326 | 329 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
8 | 17 | | |
9 | 18 | | |
10 | 19 | | |
| |||
104 | 113 | | |
105 | 114 | | |
106 | 115 | | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
107 | 120 | | |
108 | 121 | | |
109 | 122 | | |
| |||
135 | 148 | | |
136 | 149 | | |
137 | 150 | | |
138 | | - | |
139 | | - | |
140 | | - | |
141 | | - | |
142 | | - | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
143 | 154 | | |
144 | | - | |
| 155 | + | |
145 | 156 | | |
146 | 157 | | |
147 | | - | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
148 | 192 | | |
149 | | - | |
| 193 | + | |
150 | 194 | | |
151 | 195 | | |
0 commit comments