# git_ui: Show file counts in git panel section headers \(\#65028\) · gitcafe/zed

[View on GitCafe](https://git.cafe/gitcafe/zed/commit/c9daddfa0ac4d0ac097ad7812899cf3c3f2e52ec)

Repository: [gitcafe/zed](https://git.cafe/gitcafe/zed)

Visibility: public

Requested revision: c9daddfa0ac4d0ac097ad7812899cf3c3f2e52ec

Requested commit: c9daddfa0ac4d0ac097ad7812899cf3c3f2e52ec

Commit: c9daddfa0ac4d0ac097ad7812899cf3c3f2e52ec

Tree: c67904dd1044efcaf1f96dd6139f4ab78e0ca2d6

Author: Mansoor Ahmed

Committer: GitHub

## Message

```
git_ui: Show file counts in git panel section headers (#65028)

The section headers in the git panel (Staged / Unstaged, Tracked /
Untracked, and Conflicts) didn't say how many files were in each
section. With a long list of changes you had to scroll or collapse
sections to get a sense of what was staged versus not. VS Code shows a
small count next to each group, and this brings the same thing to Zed.

Each section header now shows its file count in a small chip next to the
"stage all" checkbox. The chip is hidden when a section is empty, so the
pinned empty Staged/Unstaged headers stay clean.

A couple of notes on the implementation:

- The count comes from the same per-section lists that
`update_visible_entries` already builds to render the rows, so the
number always matches what's on screen. The existing `tracked_count` /
`new_count` fields couldn't be reused here: there's no equivalent for
Staged/Unstaged, and a partially staged file shows up in both of those
sections.
- In tree view the count is the number of files, not files plus
directories.
- The badge reuses the existing `Chip` component, which the panel
already uses for tags in the history view.

I added assertions to the existing grouping tests to cover the counts
for both the staging and the status grouping.

## Showcase

### Staged / Unstaged

<table width="100%">
<tr>
<td width="50%" valign="top">

**Before**

<img width="358" height="605" alt="image"
src="https://github.com/user-attachments/assets/d23c7051-abf7-470a-9194-9e3ea7ae2a7e"
/>

</td>
<td width="50%" valign="top">

**After**

<img width="360" height="665" alt="image"
src="https://github.com/user-attachments/assets/38e5528d-0d73-4f1d-ab30-2cd0f00b8ef1"
/>

</td>
</tr>
</table>

### Tracked / Untracked

<table width="100%">
<tr>
<td width="50%" valign="top">

**Before**

<img width="360" height="631" alt="image"
src="https://github.com/user-attachments/assets/d234321e-7f3b-4215-b9ed-34a6da8d6904"
/>

</td>
<td width="50%" valign="top">

**After**

<img width="359" height="553" alt="image"
src="https://github.com/user-attachments/assets/02b702f9-89b9-4af3-876f-06ed6c1c8320"
/>

</td>
</tr>
</table>

Release Notes:

- Added file counts to section headers in the git panel
```

## Parents

- [981b224a46f26d21f925d62f67473d2df832da7b](https://git.cafe/gitcafe/zed/commit/981b224a46f26d21f925d62f67473d2df832da7b?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zed/tree/c9daddfa0ac4d0ac097ad7812899cf3c3f2e52ec?format=markdown)
