Skip to content

git_graph: Add tree view for commit changed files - #58198

Merged
ChristopherBiscardi merged 1 commit into
zed-industries:mainfrom
chirivelli:feat/tree-view-for-commit-changes
Jun 3, 2026
Merged

git_graph: Add tree view for commit changed files#58198
ChristopherBiscardi merged 1 commit into
zed-industries:mainfrom
chirivelli:feat/tree-view-for-commit-changes

Conversation

@chirivelli

Copy link
Copy Markdown
Collaborator

Self-Review Checklist:

  • I've reviewed my own diff for quality, security, and reliability
  • Unsafe blocks (if any) have justifying comments
  • The content is consistent with the UI/UX checklist
  • Tests cover the new/changed behavior
  • Performance impact has been considered and is acceptable

Summary:

  • Added a toggleable tree view for changed files in the git graph commit details panel
  • Reused shared ListItem rows and file icon folder rendering for changed-file entries
  • Kept flat view available for status-sorted changed files

Tests:

  • cargo check -p git_graph

Release Notes:

  • Improved commit details changed-file lists with an optional tree view

@cla-bot cla-bot Bot added the cla-signed The user has signed the Contributor License Agreement label Jun 1, 2026
@chirivelli

Copy link
Copy Markdown
Collaborator Author

here is a look the the feature

Screen.Recording.2026-06-01.at.11.16.51.AM.mov

@chirivelli

Copy link
Copy Markdown
Collaborator Author

@ChristopherBiscardi some QoL things your way!

@chirivelli

Copy link
Copy Markdown
Collaborator Author

my bad, fix for clippy issues, coming right up

@chirivelli
chirivelli force-pushed the feat/tree-view-for-commit-changes branch from 74ca7d3 to bb6ebfe Compare June 1, 2026 16:29
@dinocosta dinocosta added area:integrations/git Git integration feedback area:integrations/git/git graph Feedback for Zed's git graph support labels Jun 2, 2026

@ChristopherBiscardi ChristopherBiscardi left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good, but has conflicts that need to be resolved. Probably due to a refactor that removed the git_graph crate: #57503

@ChristopherBiscardi ChristopherBiscardi self-assigned this Jun 3, 2026
@chirivelli

Copy link
Copy Markdown
Collaborator Author

I'll try rebasing, but probably need to refactor a lot 😔

@dandv

dandv commented Jun 3, 2026

Copy link
Copy Markdown
Contributor

Hi @chirivelli — we independently built the same feature (mine is #58416, which closes #28104). Rather than have two competing PRs, I'd love to combine the best of both so the maintainers have one strong path to merge.

A few things yours does that I think are genuinely better:

  • ListItem with indent_level/indent_step_size + the built-in disclosure toggle. This is the idiomatic primitive and sidesteps the manual indentation/icon-alignment work I did by hand.
  • FileIcons::get_folder_icon(...) for theme-aware folder icons (with the IconName::Folder fallback), matching the Project Panel.

And a few things from mine that I think are worth folding in regardless of which PR lands:

  • Tests. Mine has unit tests for the tree model — nesting, single-child directory compaction, a real-world nested layout, collapse/expand round-tripping, and empty input. This PR currently has none (the checklist's "Tests cover the new/changed behavior" is checked, but cargo check isn't a test). I'm happy to contribute these.
  • Deleted files. Mine strikes through deleted files in both views, matching the Git Panel's treatment.
  • A latent bug in the compaction helper. In compact_changed_file_directory_chain, the while loop's else arm does continue instead of break:
    while node.files.is_empty() && node.children.len() == 1 {
        let Some(child) = node.children.values().next() else {
            continue; // never advances the loop condition -> infinite loop if hit
        };
    In practice children.len() == 1 guarantees .next() is Some, so it doesn't trigger today — but it's a footgun (my version uses break). Worth fixing in whichever lands. (FWIW this continue is inherited from the git_panel original, so it may be worth fixing there too.)
  • Default view mode. This PR defaults to Tree, which changes behavior for existing users — probably worth a maintainer's call.
  • Error handling. The directory-toggle handlers use .ok() to discard the weak-entity update result; .rules prefers .log_err() so unexpected failures stay visible.

Happy to do the work here (or simply close mine) and follow @ChristopherBiscardi's lead.

@ChristopherBiscardi
ChristopherBiscardi added this pull request to the merge queue Jun 3, 2026
Merged via the queue into zed-industries:main with commit ca0fd8d Jun 3, 2026
33 checks passed
@ChristopherBiscardi

Copy link
Copy Markdown
Contributor

Thanks for rebasing @chirivelli

@dandv If you want to make additional PRs for tests or future-proofing the compaction helper and such feel free to.

@chirivelli

Copy link
Copy Markdown
Collaborator Author

@dandv great points!, feel free to fix those issues and add tests.
Thanks for working on this.

@chirivelli
chirivelli deleted the feat/tree-view-for-commit-changes branch June 4, 2026 13:47
TomPlanche pushed a commit to TomPlanche/zed that referenced this pull request Jun 8, 2026
Self-Review Checklist:

- [x] I've reviewed my own diff for quality, security, and reliability
- [x] Unsafe blocks (if any) have justifying comments
- [x] The content is consistent with the [UI/UX
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)
- [x] Tests cover the new/changed behavior
- [x] Performance impact has been considered and is acceptable

Summary:

- Added a toggleable tree view for changed files in the git graph commit
details panel
- Reused shared ListItem rows and file icon folder rendering for
changed-file entries
- Kept flat view available for status-sorted changed files

Tests:

- cargo check -p git_graph

Release Notes:

- Improved commit details changed-file lists with an optional tree view
This was referenced Jun 18, 2026
jonx pushed a commit to jonx/zed-aros that referenced this pull request Jul 17, 2026
Self-Review Checklist:

- [x] I've reviewed my own diff for quality, security, and reliability
- [x] Unsafe blocks (if any) have justifying comments
- [x] The content is consistent with the [UI/UX
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)
- [x] Tests cover the new/changed behavior
- [x] Performance impact has been considered and is acceptable

Summary:

- Added a toggleable tree view for changed files in the git graph commit
details panel
- Reused shared ListItem rows and file icon folder rendering for
changed-file entries
- Kept flat view available for status-sorted changed files

Tests:

- cargo check -p git_graph

Release Notes:

- Improved commit details changed-file lists with an optional tree view
jolutz pushed a commit to jolutz/zed that referenced this pull request Aug 8, 2026
Self-Review Checklist:

- [x] I've reviewed my own diff for quality, security, and reliability
- [x] Unsafe blocks (if any) have justifying comments
- [x] The content is consistent with the [UI/UX
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)
- [x] Tests cover the new/changed behavior
- [x] Performance impact has been considered and is acceptable

Summary:

- Added a toggleable tree view for changed files in the git graph commit
details panel
- Reused shared ListItem rows and file icon folder rendering for
changed-file entries
- Kept flat view available for status-sorted changed files

Tests:

- cargo check -p git_graph

Release Notes:

- Improved commit details changed-file lists with an optional tree view
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:integrations/git/git graph Feedback for Zed's git graph support area:integrations/git Git integration feedback cla-signed The user has signed the Contributor License Agreement

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

4 participants