git: Move diff num stat calculation to repository snapshot layer #50645
Merged
Anthony-Eid merged 26 commits intomainfrom Mar 4, 2026
Merged
git: Move diff num stat calculation to repository snapshot layer #50645Anthony-Eid merged 26 commits intomainfrom
Anthony-Eid merged 26 commits intomainfrom
Conversation
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.
Follow up on: #49519
This PR reworks how Zed calculates diff num stats by moving the calculation to the
RepositorySnapshotlayer, instead of theGitPanel. This has a couple of benefits:FakeRepositorycan handle all the data and calculations of diff stat and make it accessible to more tests in the codebase. Because a lot of tests wouldn't initialize the git panel when they used the git repository.RepositorySnapshot.I added some integration tests as well to make sure collab support is working this time. Finally, adding the initial diff calculation to
compute_snapshotdidn't affect performance for me when checking against chromium's diff with HEAD~1000. So this should be a safe change to make.I decided to add diff stats on the status entry struct because it made updating changed paths and the collab database much simpler than having two separate SumTrees. Also whenever the UI got a file's status it would check its diff stat as well, so this change makes that code more streamlined as well.
Before you mark this PR as ready for review, make sure that you have:
Release Notes: