gitbutler icon indicating copy to clipboard operation
gitbutler copied to clipboard

Gitbutler wants to delete force delete files from repo

Open andre-s8 opened this issue 1 year ago • 13 comments

Version

0.13.16 (20241121.082346)

Operating System

macOS

Distribution Method

dmg (Apple Silicon)

Describe the issue

Whenever I start up gitbutler, it want always want to delete 2 specific files I do not know why it wants to delete these files but its just 2 icon files.

How to reproduce

https://github.com/user-attachments/assets/fc6c0427-4c91-4378-957f-24ede981f0bf

Expected behavior

The file should have been deleted in the first place

Relevant log output

No response

andre-s8 avatar Nov 22 '24 11:11 andre-s8

Thanks a lot for reporting and for the video!

Discarding the files also doesn't work and I have a feeling that these files have been removed from the index and the working tree, and this is what it picks up. Then, when discarding files, it might just try to remove it from disk and that does nothing as the file isn't there in the first place.

Could you check with git status if these files indeed show up as deleted from the index? The reason I am asking is that when trying this, it worked for me. However, during my tests I always saw the 'locked' symbol, which I don't see in the video - maybe that's related.

Thanks for your help.

Edit: Maybe you could start GitButler from the terminal as well using /Applications/GitButler.app/Contents/MacOS/gitbutler-tauri - that way logs are easily extractable in case errors show up.

Byron avatar Nov 22 '24 16:11 Byron

Hi @Byron thanks for helping me out. I tried to restore the files when I run git status it does appear.

However when I try to restore them it appears in my commit as deleted again.

image

andre-s8 avatar Nov 25 '24 06:11 andre-s8

After delete this .git folder and initialising it again I am still getting this bug. its very weird.

andre-s8 avatar Nov 25 '24 07:11 andre-s8

It is very strange indeed.

Even if I locally remove a file from the worktree, and then discard that change in the GitButler UI, I have the expected effect as the file is restored, similar to what git restore <file> would do.

I thought for a moment that the files might be ignored, but when I do that the changes don't show up at all, I created #5662 for this.

Maybe these files have .gitattributes assigned to them that somehow have an effect on this?

Byron avatar Nov 25 '24 08:11 Byron

There is no git attributes for the files, I even tried manually cloning using gitbutler ui but it gives me the same story, it wants to delete the files, I didn't even start typing or anything.

image

andre-s8 avatar Nov 25 '24 08:11 andre-s8

@Byron I do have logs I can provide, however I am wary to share them because it may contain organisational data.

andre-s8 avatar Nov 25 '24 08:11 andre-s8

@Byron seems to be with the reset_files and reset_files:create_nsapshot handle:recalculate_everything or something.

andre-s8 avatar Nov 25 '24 08:11 andre-s8

Thanks for taking a look! If ERROR shows up in the logs, that would definitely mean something. Strangely, git status also shows them as deleted, because they are - at least this is what I understood from the picture. And restoring them even with Git doesn't actually do anything, right?

If so, it's somewhat unrelated to GitButler it seems, but maybe the redacted version of ERROR messages can be shared here to shed some light.

Byron avatar Nov 25 '24 08:11 Byron

Restoring the files does does not help, gitbutler will mark them as deleted for some reason and would want to add it to the commit. the files do exists I have check the repo on our production branch and we do use them.

There no errors just INFO logs.

andre-s8 avatar Nov 25 '24 08:11 andre-s8

I see… unfortunately it remains a mystery what's happening here.

Only one more thing - could you confirm that git status also shows them as deleted? And after restoring them with Git, git status is clean? If that's the case, it's the question how they get deleted again - right now it feels like going into GitButler is all it takes to get them deleted somehow.

Byron avatar Nov 25 '24 11:11 Byron

Hi @Byron! I'm here because this just happened to me, too. I just got back to work this morning, and noticed my config.toml file is gone. I couldn't find it in my macOS bin, and when I tried to recreate the file (e.g. using touch config.toml) it would automatically delete itself!

As soon as I quit GitButler, I could create the config.toml without it being deleted.

This is very scary to me as

  1. I'm not sure what else it deleted
  2. I'm not sure what else it might delete in the future, so I'm scared to use GitButler again now.

M2 Pro macOS 15.3.1 (24D70) GitButlerVersion 0.14.19 (20250428.160452)

😬

nz-chris avatar May 07 '25 20:05 nz-chris

Thanks for sharing this unpleasant experience and I am sorry you had to experience this - it is very, very scary :/.

Even though it's still unclear what is causing this, if you wanted to launch GitButler just one more time to type v3 then it will switch to the next major version which is basically a rewrite. I would expect it to not exhibit this behaviour. Thank you 🙏.

Byron avatar May 08 '25 04:05 Byron

Update: I encountered an issue that caused me to love a lot more files by committing to the gitbutler/workspace branch outside of GitButler (bad idea in retrospect) and then re-opening GitButler and trying out v3...

@krlvi helped me out to get my files back and let me know that the v3 rollout and the following weeks of stabilizing the app will make this sort of issue a thing of the past. Thanks again!

To be safe, I personally will use GitButler again in a month or so. I'm confident I'll come back and not experience such an issue again :)

nz-chris avatar May 09 '25 01:05 nz-chris