Skip to content

Fix Git panel history in detached HEAD - #60537

Closed
gaojunran wants to merge 6 commits into
zed-industries:mainfrom
gaojunran:fix-git-panel-history-detached-head-upstream
Closed

Fix Git panel history in detached HEAD#60537
gaojunran wants to merge 6 commits into
zed-industries:mainfrom
gaojunran:fix-git-panel-history-detached-head-upstream

Conversation

@gaojunran

@gaojunran gaojunran commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Objective

Fixes #57783.

Solution

Use the current branch as the Git panel History source when available, but fall back to the current HEAD commit when the repository is in detached HEAD. If neither a branch nor HEAD commit is available, resolve the history state as empty instead of leaving it loading indefinitely.

Testing

  • Did you test these changes? If so, how? Unit test and manual test on built macos app
  • Are there any parts that need more testing? I think no
  • How can other people (reviewers) test your changes? Is there anything specific they need to know? This is a minor fix and I think code can tell
  • If relevant, what platforms did you test these changes on, and are there any important ones you can't test? macos. This is not platform specific.

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:

  • Fix Git panel history in detached HEAD

@cla-bot cla-bot Bot added the cla-signed The user has signed the Contributor License Agreement label Jul 7, 2026
@zed-community-bot zed-community-bot Bot added the first contribution the author's first pull request to Zed. NOTE: the label application is automated via github actions label Jul 7, 2026

@dinocosta dinocosta 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.

Hey @gaojunran ! Thank you for taking the time to try and improve Zed 🙂

Unfortunately, it seems that this might not actually be working as expected? Although the "Loading more commits..." message is no longer shown, it's showing "No commits yet" instead. I believe we'd expect to still be able to view the history, starting from the current commit but do let me know if there's something I'm missing.

CleanShot.2026-07-07.at.14.58.51.mp4

@dinocosta dinocosta added the area:integrations/git Git integration feedback label Jul 7, 2026
@gaojunran
gaojunran marked this pull request as draft July 7, 2026 14:39
@gaojunran
gaojunran marked this pull request as ready for review July 8, 2026 12:31
@gaojunran
gaojunran requested a review from dinocosta July 8, 2026 12:31
@gaojunran

Copy link
Copy Markdown
Contributor Author

@dinocosta Now it gets fixed:

image

(If you want to manually test it you can just use my own built: https://github.com/gaojunran/zed/actions/runs/28912313110)

@dinocosta dinocosta self-assigned this Jul 8, 2026
@yeskunall

Copy link
Copy Markdown
Member

@gaojunran @dinocosta -- also see #57959.

@dinocosta

Copy link
Copy Markdown
Member

@gaojunran @dinocosta -- also see #57959.

Thank you so much for sharing @yeskunall ! 🙇

@gaojunran Seeing as that Pull Request is already open, I'm going to close this one, sorry that I didn't immediately spot it! However, I noticed that your changes are considerably smaller than the other Pull Request, not sure if that's because the other one has more tests but, in any case, feel free to take a look at that other Pull Request and suggest things you believe your Pull Request did better. I'll also link this Pull Request there 🙂

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 first contribution the author's first pull request to Zed. NOTE: the label application is automated via github actions

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

Git history missing for detached branch

3 participants