zed-industries / zed

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
https://zed.dev
Other
46.61k stars 2.64k forks source link

Git information can get out of sync #13176

Closed maxdeviant closed 1 week ago

maxdeviant commented 2 months ago

Check for existing issues

Describe the bug / provide steps to reproduce it

Don't have concrete reproduction steps yet, but have been noticing some instances where Zed's Git information gets out of sync with the real state of Git.

Here's an example of it happening:

Screenshot 2024-06-17 at 5 41 41 PM

Note that in Zed my branch is marshall/show-crate-indexing-status and I have some Git diffs shown in this buffer.

However, running git status from my terminal shows that I am on a different branch (main) and have a clean working tree:

λ git status
On branch main
Your branch is up to date with 'origin/main'.

nothing to commit, working tree clean

Environment

Zed: v0.141.0 (Zed Nightly 0afb3abfd24c4f9851fc8a8ef37da89cb754dd41) OS: macOS 14.4.0 Memory: 128 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

notpeter commented 2 months ago

I observed this again today. I had a Zed window open and changed branches via the command line in MacOS terminal. When I returned the window a couple hours later git was out of sync (note title bar has wrong branch). I didn't see anything notable in the logs.

Of note, my laptop did sleep/wake while checked out on the v0.141.x branch.

image

hedefalk commented 2 months ago

+1, git branch up in the left doesn't seem to ever update for me after initializing the editor.

christian-gama commented 1 month ago

I'm constantly having to reload Zed when I make git commits. They're not synching, keeping the files with a different color, indicating that there is a change tracked by git, but there is actually no changes because I've already committed. Reloading solves the problem, but it's quite annoying to reload every time. The opposite is also true: sometimes I have an actual change but Zed does not change the file color, until I open that file and then the color appears, but if I close the file, it will lose the color that indicates that change.

It becomes worse if I change my branch.

Moshyfawn commented 2 weeks ago

Reliable (?) reproduction steps

  1. Open a Node.js project in Zed (I've only tested the collapsing files tree issue with a Node.js project) (optional) 2. Open the project panel
  2. Open integrated terminal and run pnpm install (I haven't tested with npm or yarn) (optional) 4. Notice how the files tree is collapsed (seeminglly unrelated to the issue at hand, but it seems important)
  3. Create a branch in the terminal with git checkout -b test/branch
  4. Notice how the local branch switch has the stale branch name (I think the file's git status colours and the gutter icons are also outdated; haven't checked that yet.)