zed icon indicating copy to clipboard operation
zed copied to clipboard

Inline git blame isn't restored when undoing deleted lines

Open JosephTLyons opened this issue 1 year ago • 3 comments

Check for existing issues

  • [X] Completed

Describe the bug / provide steps to reproduce it

  1. Put cursor on the line of some version tracked code - notice the inline blame
  2. Delete line, do not save file
  3. Undo the deletion
  4. Notice there is no longer inline blame

Saving the file brings the inline blame back

Environment

Zed: v0.132.0 (Zed Nightly d1928f084e91ccacafaf28eee1ccf5cfef99e6ff) OS: macOS 14.3.1 Memory: 64 GiB Architecture: aarch64

If applicable, add mockups / screenshots to help explain present your vision of the feature

No response

If applicable, attach your ~/Library/Logs/Zed/Zed.log file to this issue.

No response

JosephTLyons avatar Apr 15 '24 22:04 JosephTLyons

This might run deeper than inline git blame - not sure - but maybe it has to do with Zed not really being sure if the content is the same as it was before?

JosephTLyons avatar Apr 15 '24 22:04 JosephTLyons

Yeah, I think it's unrelated to git blame. If you save the file again after undoing the deletion, the blame information comes back, but the file didn't look "unsaved".

mrnugget avatar Apr 16 '24 07:04 mrnugget

I am on the stable version of Zed(Zed 0.130.7) and tried two things: Step 1) cut a Line (Cmd-X) 2) The first time i did an undo (the blue icon disappeared at the top beside filename), the second time i just pasted it. I never saved the file(turned off autosave also from settings.json) Both times git blame worked after i toggled it on and off. If this was only an issue about zed not being able to identify the file had changed or not. Shouldn't it have worked the first time? Attaching a screen Recording along with this The file size is too big for github (pasting link to discord channel media) https://discord.com/channels/869392257814519848/873292398204170290/1229884007622250556

hshreekar avatar Apr 16 '24 20:04 hshreekar

Yeah, the problem is that we splice all edits into the git blame data. Undos count as edits too. So from the perspective of our data model, the line has been edited, even though the user visible edit has been undone.

mrnugget avatar Apr 17 '24 08:04 mrnugget