Fix Git panel history in detached HEAD - #60537
Conversation
dinocosta
left a comment
There was a problem hiding this comment.
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
…-git-panel-history-detached-head-upstream # Conflicts: # crates/git_ui/src/git_panel.rs
|
@dinocosta Now it gets fixed:
(If you want to manually test it you can just use my own built: https://github.com/gaojunran/zed/actions/runs/28912313110) |
|
@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 🙂 |

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
Self-Review Checklist:
Release Notes: