Skip to content

git_panel: Show staged and unstaged diff stats - #60815

Merged
ChristopherBiscardi merged 2 commits into
zed-industries:mainfrom
chirivelli:feat/git-panel-staging-stats
Jul 18, 2026
Merged

git_panel: Show staged and unstaged diff stats#60815
ChristopherBiscardi merged 2 commits into
zed-industries:mainfrom
chirivelli:feat/git-panel-staging-stats

Conversation

@chirivelli

@chirivelli chirivelli commented Jul 11, 2026

Copy link
Copy Markdown
Collaborator

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 git_panel: Add group by staging view option #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:

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

Release Notes:

  • Fixed diff stats for partially staged files in the Git panel

@cla-bot cla-bot Bot added the cla-signed The user has signed the Contributor License Agreement label Jul 11, 2026
@zed-community-bot zed-community-bot Bot added the guild Pull requests by someone in Zed Guild. NOTE: the label application is automated via github actions label Jul 11, 2026
@chirivelli
chirivelli force-pushed the feat/git-panel-staging-stats branch from 21dcc60 to 3c3535d Compare July 12, 2026 12:54
@ChristopherBiscardi ChristopherBiscardi self-assigned this Jul 12, 2026
@chirivelli
chirivelli force-pushed the feat/git-panel-staging-stats branch from 3c3535d to fad4c95 Compare July 15, 2026 08:08
@chirivelli

Copy link
Copy Markdown
Collaborator Author

rebased on top of main!
after #60976 got merged

@SomeoneToIgnore SomeoneToIgnore added the area:integrations/git Git integration feedback label Jul 16, 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.

thanks! Don't forget to include images when making visual change PRs.

before (note whatever.py)

Image

after

Image

@ChristopherBiscardi
ChristopherBiscardi added this pull request to the merge queue Jul 18, 2026
Merged via the queue into zed-industries:main with commit 54fdf58 Jul 18, 2026
45 checks passed
@chirivelli
chirivelli deleted the feat/git-panel-staging-stats branch July 21, 2026 02:50
jolutz pushed a commit to jolutz/zed that referenced this pull request Aug 8, 2026
# 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
zed-industries#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 panel
playdohface pushed a commit to playdohface/zed that referenced this pull request Aug 29, 2026
# 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
zed-industries#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 panel
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:integrations/git Git integration feedback cla-signed The user has signed the Contributor License Agreement guild Pull requests by someone in Zed Guild. NOTE: the label application is automated via github actions

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

3 participants