eclipse-egit / egit

EGit, the git integration of Eclipse IDE

Home Page:https://www.eclipse.org/egit/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

All files deleted or untracked every so often

j256 opened this issue · comments

commented

Version

6.5.0.202303070854-r

Operating System

MacOS

Eclipse version

2023-03 (4.27.0)

Bug description

Every once and a while, maybe when I'm transitioning between branches, I will find that all of my files have been deleted in my repository. I have recently moved to a new Macbook and had upgraded to 2024-01 (I think) version of Eclipse and saw this so went back to the 2023-03 version but just saw it again.

Actual behavior

As far as I can tell, I just did a:

  • Push to new branch.
  • Submitted a bunch of files.
  • Merged and deleted the branch on github.
  • Did another push by accident. Atypical.
  • Switched back to master on my laptop.
  • Did a pull which updated my files.
  • A couple of minutes later I noticed that all of my files are marked with a ?. Doing a git log shows them all either as deleted or untracked.

Expected behavior

I did not expect all of my files to be deleted.

Relevant log output

No response

Other information

No response

I suspect the pull command combined with deleting the branch on github is causing this.
Depending on what you did exactly this may or may not be the expected behavior.
Try what you did but use fetch instead of pull. Does that change the result ?
Pull is the combination of fetch and either merge or rebase depending on the configuration.
Maybe your local branch is tracking the upstream branch which you deleted ?

Apart from that try to update to the latest EGit release 6.8.0.202311291450-r [1] and check if this helps.
We only maintain the last EGit release and can't spend time on patching older releases. For critical bugs we
may consider to create a service release otherwise fixes are available in the nightly build as soon as
a change was approved and submitted or in the next planned release (every 3 months with the simultaneous release
of Eclipse IDE).

The last Eclipse IDE release was 2023-12, the next one is 2024-03 which will be shipped on March 13 [2].

[1] https://download.eclipse.org/egit/updates-6.8
[2] https://github.com/eclipse-simrel/.github/blob/main/wiki/Simultaneous_Release.md

commented

I've never used fetch and I've been using egit for like 8 years. Not sure what is going on.

Isn't it standard to:

  1. push a branch to github
  2. approve it and merge it
  3. delete the branch on github
  4. return to your local dev box and switch to the main branch
  5. run git pull

This is what I've been doing forever.

Also, is there a way to turn on logging in egit so I can see at what point it goes off the rails?

when this happens again, please check if the git config of that repo still looks good. Over the years I had a handful of occurrences where my git config was empty or almost empty after some egit operation, and that had similar confusing effects like you describe. In my case it was sufficient to restore the config file.

commented

Just was able to reproduce this so I made a screen recording of it.

https://www.youtube.com/watch?v=sslAA5uYDLs

Thanks @Bananeweizen . The .git/config doesn't seem to have been modified since May 24th so I don't think it is has been changed. Anything else I can check?

commented

@msohn It doesn't seem to be related to deleting the branch since I hadn't gotten as far as even pushing the branch up to github.

I watched your reproducer video and I think it's not the files in the working tree you lost but it's the git index (that's the .git/index file in the .git repository folder). That's why the index version isn't shown anymore in the diff view.

The git index is a cache of file metadata to speed up git status which needs to find out which files have been modified in the working tree. See https://mincong.io/2018/04/28/git-index/.

You can try to recreate it using

git reset         # re-scan the working directory
git add -u        # update the index

Maybe there is interference with some other process like an on-access virus scan on your machine ?