Commit 54fdf58
authored
git_panel: Show staged and unstaged diff stats (#60815)
# Objective
- Show accurate diff stats for each staged and unstaged projection of a
partially staged file in the Git panel.
- This was originally considered for
#59884, but was scoped out of
that already-large PR and is being submitted separately as discussed
there.
## Solution
- Collect HEAD-to-index and index-to-worktree diff stats alongside the
existing combined HEAD-to-worktree stats.
- Carry the staged and unstaged stats through repository status
snapshots and remote status serialization.
- Use the stat matching the projected Git panel section while preserving
the combined stat for the other grouping modes.
- Update the fake Git repository and add regression coverage with
deliberately different staged and unstaged counts.
## Testing
- `cargo check -p git_ui`
- `cargo check -p collab`
- `cargo test -p git_ui
test_group_by_staging_section_membership_and_order --lib`
- `cargo test -p project --lib --no-run`
- `cargo fmt --all -- --check`
- `git diff --check`
## 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 adheres to Zed's UI standards
([UX/UI](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)
and
[icon](https://github.com/zed-industries/zed/blob/main/crates/icons/README.md)
guidelines)
- [x] Tests cover the new/changed behavior
- [x] Performance impact has been considered and is acceptable
---
Release Notes:
- Fixed diff stats for partially staged files in the Git panel1 parent eb96279 commit 54fdf58
7 files changed
Lines changed: 241 additions & 47 deletions
File tree
- crates
- collab/src
- fs/src
- git_ui/src
- git/src
- project
- src
- tests/integration
- proto/proto
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
732 | 732 | | |
733 | 733 | | |
734 | 734 | | |
| 735 | + | |
| 736 | + | |
| 737 | + | |
| 738 | + | |
735 | 739 | | |
736 | 740 | | |
737 | 741 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1156 | 1156 | | |
1157 | 1157 | | |
1158 | 1158 | | |
| 1159 | + | |
1159 | 1160 | | |
1160 | 1161 | | |
1161 | 1162 | | |
| |||
1203 | 1204 | | |
1204 | 1205 | | |
1205 | 1206 | | |
1206 | | - | |
1207 | | - | |
1208 | | - | |
1209 | | - | |
1210 | | - | |
1211 | | - | |
1212 | | - | |
1213 | | - | |
1214 | | - | |
| 1207 | + | |
| 1208 | + | |
| 1209 | + | |
| 1210 | + | |
| 1211 | + | |
| 1212 | + | |
| 1213 | + | |
| 1214 | + | |
| 1215 | + | |
| 1216 | + | |
| 1217 | + | |
| 1218 | + | |
| 1219 | + | |
| 1220 | + | |
| 1221 | + | |
| 1222 | + | |
| 1223 | + | |
| 1224 | + | |
| 1225 | + | |
| 1226 | + | |
| 1227 | + | |
| 1228 | + | |
| 1229 | + | |
| 1230 | + | |
| 1231 | + | |
| 1232 | + | |
| 1233 | + | |
| 1234 | + | |
| 1235 | + | |
| 1236 | + | |
1215 | 1237 | | |
1216 | 1238 | | |
1217 | 1239 | | |
1218 | 1240 | | |
1219 | | - | |
1220 | | - | |
1221 | | - | |
| 1241 | + | |
| 1242 | + | |
| 1243 | + | |
1222 | 1244 | | |
1223 | 1245 | | |
1224 | 1246 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1109 | 1109 | | |
1110 | 1110 | | |
1111 | 1111 | | |
| 1112 | + | |
1112 | 1113 | | |
1113 | 1114 | | |
1114 | 1115 | | |
| |||
1193 | 1194 | | |
1194 | 1195 | | |
1195 | 1196 | | |
| 1197 | + | |
| 1198 | + | |
| 1199 | + | |
| 1200 | + | |
| 1201 | + | |
| 1202 | + | |
| 1203 | + | |
1196 | 1204 | | |
1197 | 1205 | | |
1198 | 1206 | | |
| |||
2333 | 2341 | | |
2334 | 2342 | | |
2335 | 2343 | | |
| 2344 | + | |
2336 | 2345 | | |
2337 | 2346 | | |
2338 | 2347 | | |
| |||
2341 | 2350 | | |
2342 | 2351 | | |
2343 | 2352 | | |
2344 | | - | |
2345 | | - | |
2346 | | - | |
2347 | | - | |
2348 | | - | |
2349 | | - | |
| 2353 | + | |
| 2354 | + | |
| 2355 | + | |
| 2356 | + | |
| 2357 | + | |
| 2358 | + | |
| 2359 | + | |
2350 | 2360 | | |
2351 | 2361 | | |
2352 | 2362 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4548 | 4548 | | |
4549 | 4549 | | |
4550 | 4550 | | |
4551 | | - | |
| 4551 | + | |
4552 | 4552 | | |
4553 | | - | |
4554 | | - | |
4555 | | - | |
| 4553 | + | |
| 4554 | + | |
| 4555 | + | |
4556 | 4556 | | |
4557 | | - | |
| 4557 | + | |
4558 | 4558 | | |
4559 | 4559 | | |
4560 | 4560 | | |
| |||
4564 | 4564 | | |
4565 | 4565 | | |
4566 | 4566 | | |
4567 | | - | |
4568 | | - | |
| 4567 | + | |
| 4568 | + | |
4569 | 4569 | | |
4570 | | - | |
| 4570 | + | |
4571 | 4571 | | |
4572 | 4572 | | |
4573 | 4573 | | |
| |||
4583 | 4583 | | |
4584 | 4584 | | |
4585 | 4585 | | |
4586 | | - | |
| 4586 | + | |
| 4587 | + | |
| 4588 | + | |
| 4589 | + | |
4587 | 4590 | | |
4588 | 4591 | | |
4589 | | - | |
| 4592 | + | |
| 4593 | + | |
| 4594 | + | |
| 4595 | + | |
4590 | 4596 | | |
4591 | 4597 | | |
4592 | 4598 | | |
| |||
9339 | 9345 | | |
9340 | 9346 | | |
9341 | 9347 | | |
9342 | | - | |
9343 | 9348 | | |
9344 | 9349 | | |
9345 | 9350 | | |
| |||
9552 | 9557 | | |
9553 | 9558 | | |
9554 | 9559 | | |
| 9560 | + | |
| 9561 | + | |
| 9562 | + | |
| 9563 | + | |
| 9564 | + | |
| 9565 | + | |
| 9566 | + | |
| 9567 | + | |
| 9568 | + | |
| 9569 | + | |
9555 | 9570 | | |
9556 | 9571 | | |
9557 | 9572 | | |
| |||
9626 | 9641 | | |
9627 | 9642 | | |
9628 | 9643 | | |
| 9644 | + | |
| 9645 | + | |
| 9646 | + | |
| 9647 | + | |
| 9648 | + | |
| 9649 | + | |
| 9650 | + | |
| 9651 | + | |
| 9652 | + | |
| 9653 | + | |
| 9654 | + | |
| 9655 | + | |
| 9656 | + | |
| 9657 | + | |
| 9658 | + | |
| 9659 | + | |
| 9660 | + | |
| 9661 | + | |
9629 | 9662 | | |
9630 | 9663 | | |
9631 | 9664 | | |
| |||
0 commit comments