File is shown as changed even though it has no change
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
rgitas project in GitButler - see how it looks like, and compare with
git status
Expected behavior
Nothing should be shown as changed.
Relevant log output
No response
I thought you might find this interesting, @krlvi .
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
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.