-
-
Notifications
You must be signed in to change notification settings - Fork 6.8k
git: Add diff view for stash entries #38280
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
git: Add diff view for stash entries #38280
Conversation
0b98347 to
5b99d02
Compare
90ce54f to
e614ce3
Compare
8a41a85 to
b9339ed
Compare
b9339ed to
a0b7eff
Compare
a0b7eff to
a48df5f
Compare
|
Hey @cole-miller, sorry to ping you here! Just wanted to check if there's anything I can change or improve to help move this along, let me know. Thanks, and sorry again for the ping :) (same goes for #38719) |
cole-miller
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @AlvaroParker and sorry for not reviewing this sooner--the code and design here generally look great, well done! I really like how this reuses the existing commit view and even simplifies it a little bit in the process. I just have a couple of small design comments and then this should be good to merge.
|
Thanks @AlvaroParker, nicely done! |
Continues the work from #35927 to add a git diff view for stash entries.
Screencast.From.2025-09-17.19-46-01.webm
Stash entries are represented as commits except they have up to 3 parents:
Where
His theHEADcommit,Iis a commit that records the state of the index, andUis another commit that records untracked files (when usinggit stash -u).Given this, I modified the existing commit view struct to allow loading stash and commits entries with git sha identifier so that we can get a similar git diff view for both of them.
The stash diff is generated by comparing the stash commit with its parent (
<commit>^orHin the diagram) which generates the same diff as doinggit stash show -p <stash entry>. This can be counter-intuitive since a user may expect the comparison to be made between the stash commit and the current commit (HEAD), but given that the default behavior in git cli is to compare with the stash parent, I went for that approach.Hoping to get some feedback from a Zed team member to see if they agree with this approach.
Release Notes: