feat(changes-panel): show git indicators on parent folders in tree view
Summary
- Propagate each changed file's git status to every ancestor directory in the Git Changes tree
- Show the existing
GitChangeStatusIconon folder rows in tree view (including when collapsed) - When a folder has mixed descendant statuses, use the highest-priority status (conflicted → deleted → modified → renamed → added)
Closes #2337
Test plan
- [x]
pnpm exec vitest run src/renderer/features/tasks/diff-view/changes-panel/components/changes-tree-utils.test.ts - [x] Manual: open a task with nested unstaged changes, switch Changes panel to tree view
- [x] Confirm parent folders (
src,src/components, etc.) show status icons - [x] Collapse a parent folder — icon remains visible on the folder row
- [x] Confirm flat list view and file-level indicators are unchanged
Greptile Summary
This PR propagates each changed file's git status up to all ancestor directories in the Changes panel tree view, then renders the existing GitChangeStatusIcon on directory rows (including when collapsed). When a directory has descendants with mixed statuses, the highest-priority status wins according to a fixed precedence: conflicted > deleted > modified > renamed > added.
changes-tree-utils.ts: addsSTATUS_PRIORITY,upsertDirectoryStatus, and adirectoryStatusByPathmap populated during tree construction; exposesbuildDirectoryStatusByPathfor testing.virtualized-changes-tree.tsx: threadsdirectoryStatusByPath.get(node.path)intoDirectoryRowand conditionally rendersGitChangeStatusIconwithin the button row.changes-tree-utils.test.ts: new test file covering ancestor propagation, all adjacent priority pairs, sibling isolation with an explicit size guard, root-level files, andbuildChangesTreeintegration.
Confidence Score: 5/5
Safe to merge — the change is additive, well-tested, and touches only the tree-view rendering path without affecting the flat list view or file-level indicators.
The status-propagation logic is correct: every ancestor directory is updated during the same loop that builds the node graph, so directoryStatusByPath and directoryPaths are always in sync. The priority comparison is exhaustive over the full GitChangeStatus union, TypeScript enforces completeness of the STATUS_PRIORITY record, and the undefined-guard in DirectoryRow ensures missing entries degrade gracefully.
No files require special attention.
Important Files Changed
| Filename | Overview |
|---|---|
| src/renderer/features/tasks/diff-view/changes-panel/components/changes-tree-utils.ts | Adds STATUS_PRIORITY map and upsertDirectoryStatus helper; populates directoryStatusByPath for every ancestor directory during tree construction; exports buildDirectoryStatusByPath wrapper for tests. Logic is correct and exhaustive. |
| src/renderer/features/tasks/diff-view/changes-panel/components/virtualized-changes-tree.tsx | Passes directoryStatusByPath.get(node.path) to DirectoryRow and renders GitChangeStatusIcon when a status is present; safely handles absent status via undefined guard. No layout regressions. |
| src/renderer/features/tasks/diff-view/changes-panel/components/changes-tree-utils.test.ts | New test file covering ancestor propagation, all adjacent priority pairs, sibling isolation with size guard and explicit false-positive check, root-level files, and buildChangesTree integration. |
Reviews (2): Last reviewed commit: "test(changes-panel): rename sibling isol..." | Re-trigger Greptile
@greptileai
Hi @Cincinnatus101010, thanks for the PR, including the tests and the quick follow-ups on Greptile feedback. This branch has unfortunately fallen out of date with conflicts and we're closing out stale PRs, so I'm going to close it for now. The underlying feature is still something we'd like, if you're up for rebasing onto latest main, feel free to open a fresh PR and we'll take a look. Thanks again!