gitbutler icon indicating copy to clipboard operation
gitbutler copied to clipboard

File is shown as changed even though it has no change

Open Byron opened this issue 1 year ago • 3 comments

Version

Version 20240802.073826 or 0.12.16

Operating System

Mac OS X

Distribution Method

dmg (Apple Silicon)

Describe the issue

A file is shown as changed with zero lines changed, even though git status is clear and shows no changes.

How to reproduce

  • unzup the following file: rgit.zip
  • add rgit as project in GitButler
  • see how it looks like, and compare with git status
Screenshot 2024-08-02 at 09 43 27 Screenshot 2024-08-02 at 09 43 00

Expected behavior

Nothing should be shown as changed.

Relevant log output

No response

Byron avatar Aug 02 '24 07:08 Byron

I thought you might find this interesting, @krlvi .

Byron avatar Aug 02 '24 07:08 Byron

This is an interesting one. It appears that there is a file mode change:

diff --git a/this b/this
new file mode 100644
index 0000000..e69de29

The diffing that happens inside the app is actually tree-to-tree, in particular here https://github.com/gitbutlerapp/gitbutler/blob/c177419aee79fce1cc6885df693afe89ad058465/crates/gitbutler-diff/src/diff.rs#L174

So the equivalent operation in the git cli is git diff 9245909d716bdfc3c54c35839f4009df7e943f9c HEAD (the 9245909d716bdfc3c54c35839f4009df7e943f9c sha comes from .git/gitbutler/virtual_branches.toml -> default_target -> sha

krlvi avatar Aug 02 '24 10:08 krlvi

That is very interesting!

Locally I don't see it even though git status would show filemode changes. I never checked what was compressed into the zip file though, but after doing so it does seem to show exactly the same issue.

The filemode change with diff I can't see as my diff doesn't have the --git option, but I could imagine that git2 picks up some filemode change the Git normalizes and thus ignores.

Let's just say this shouldn't happen with gitoxide.

Byron avatar Aug 03 '24 06:08 Byron