Skip to content

git_ui: Fix history tab empty and detached HEAD states - #57959

Merged
smitbarmase merged 1 commit into
zed-industries:mainfrom
Revantark:empty-state
Jul 9, 2026
Merged

git_ui: Fix history tab empty and detached HEAD states#57959
smitbarmase merged 1 commit into
zed-industries:mainfrom
Revantark:empty-state

Conversation

@Revantark

Copy link
Copy Markdown
Contributor

This PR fixes a few History tab edge cases in the Git Panel.

For a fresh repo with no commits, the History tab now finishes loading and shows No commits yet instead
of sitting on Loading… indefinitely or falling into a misleading empty/error state.

It also fixes detached HEAD history loading. In that case, the Git Panel asks the backend to load history
from the current commit SHA. The local git backend was accidentally treating the raw object ID bytes as a
string instead of formatting them as a normal hex SHA, so git log could fail before returning any
commits. The backend now passes the SHA in the format git expects.

Repro for empty repo:

mkdir /tmp/zed-empty-history
cd /tmp/zed-empty-history
git init
zed .

Open Git Panel → History.

Before: History could stay stuck on Loading….
After: History shows No commits yet.

Repro for detached HEAD:

mkdir /tmp/zed-detached-history
cd /tmp/zed-detached-history
git init
echo hi > file
git add file
git commit -m initial
git checkout --detach HEAD
zed .

Open Git Panel → History.

Before: History could fail to load commits.
After: History shows the commit history normally.

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

Release Notes:

  • Fixed Git history tab states for empty repositories and detached HEAD history.

@cla-bot cla-bot Bot added the cla-signed The user has signed the Contributor License Agreement label May 28, 2026
@smitbarmase smitbarmase added the area:integrations/git Git integration feedback label May 29, 2026
@smitbarmase smitbarmase self-assigned this Jun 1, 2026

@smitbarmase smitbarmase left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks. I fixed a few conflicts after the rebase and added supporting tests.

@Revantark

Copy link
Copy Markdown
Contributor Author

@smitbarmase thanks and I can take a look at tests tomorrow and patch them up.

@Revantark

Copy link
Copy Markdown
Contributor Author

@smitbarmase updated

@dinocosta

Copy link
Copy Markdown
Member

@smitbarmase Let me know if you eventually want to take a look at this one together. I was also considering reviewing #60537 before Kunall pointed me to this one 🙂

@smitbarmase

Copy link
Copy Markdown
Member

I think CI was failing on a test I couldn’t spend time figuring out. I can take a look today, or lets pair on it.

@smitbarmase
smitbarmase added this pull request to the merge queue Jul 9, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Jul 9, 2026
@smitbarmase
smitbarmase added this pull request to the merge queue Jul 9, 2026
Merged via the queue into zed-industries:main with commit 35ffa8f Jul 9, 2026
34 checks passed
jolutz pushed a commit to jolutz/zed that referenced this pull request Aug 8, 2026
…s#57959)

This PR fixes a few History tab edge cases in the Git Panel.

For a fresh repo with no commits, the History tab now finishes loading
and shows No commits yet instead
of sitting on Loading… indefinitely or falling into a misleading
empty/error state.

It also fixes detached HEAD history loading. In that case, the Git Panel
asks the backend to load history
from the current commit SHA. The local git backend was accidentally
treating the raw object ID bytes as a
string instead of formatting them as a normal hex SHA, so git log could
fail before returning any
commits. The backend now passes the SHA in the format git expects.

**Repro for empty repo:**

mkdir /tmp/zed-empty-history
cd /tmp/zed-empty-history
git init
zed .

Open Git Panel → History.

Before: History could stay stuck on Loading….
After: History shows No commits yet.

**Repro for detached HEAD:**

mkdir /tmp/zed-detached-history
cd /tmp/zed-detached-history
git init
echo hi > file
git add file
git commit -m initial
git checkout --detach HEAD
zed .

Open Git Panel → History.

Before: History could fail to load commits.
After: History shows the commit history normally.




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


Release Notes:

- Fixed Git history tab states for empty repositories and detached HEAD
history.

Co-authored-by: Smit Barmase <heysmitbarmase@gmail.com>
playdohface pushed a commit to playdohface/zed that referenced this pull request Aug 29, 2026
…s#57959)

This PR fixes a few History tab edge cases in the Git Panel.

For a fresh repo with no commits, the History tab now finishes loading
and shows No commits yet instead
of sitting on Loading… indefinitely or falling into a misleading
empty/error state.

It also fixes detached HEAD history loading. In that case, the Git Panel
asks the backend to load history
from the current commit SHA. The local git backend was accidentally
treating the raw object ID bytes as a
string instead of formatting them as a normal hex SHA, so git log could
fail before returning any
commits. The backend now passes the SHA in the format git expects.

**Repro for empty repo:**

mkdir /tmp/zed-empty-history
cd /tmp/zed-empty-history
git init
zed .

Open Git Panel → History.

Before: History could stay stuck on Loading….
After: History shows No commits yet.

**Repro for detached HEAD:**

mkdir /tmp/zed-detached-history
cd /tmp/zed-detached-history
git init
echo hi > file
git add file
git commit -m initial
git checkout --detach HEAD
zed .

Open Git Panel → History.

Before: History could fail to load commits.
After: History shows the commit history normally.




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


Release Notes:

- Fixed Git history tab states for empty repositories and detached HEAD
history.

Co-authored-by: Smit Barmase <heysmitbarmase@gmail.com>
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

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

3 participants