Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mismatched binary detection behaviour on diffs #991

Open
FintanH opened this issue Sep 22, 2023 · 5 comments
Open

Mismatched binary detection behaviour on diffs #991

FintanH opened this issue Sep 22, 2023 · 5 comments

Comments

@FintanH
Copy link

FintanH commented Sep 22, 2023

Hey 馃憢

I have a peculiar case that I've created a reproducible for. If you clone this repository https://github.com/FintanH/git2-binary-check and do cargo run, you'll get the following output:

Path: "bin/cat"
Is binary: false
Path: "bin/ls"
Is binary: false
Path: "bin/test"
Is binary: false

However, if you were to run git diff 373b3404371e359404392aff715d504293112c8b abdedcec89e3c48ac520e4a96c7ea39364316b9e, you'll get:

diff --git a/bin/cat b/bin/cat
new file mode 100755
index 0000000..0bbb14b
Binary files /dev/null and b/bin/cat differ
diff --git a/bin/ls b/bin/ls
new file mode 100755
index 0000000..87c2d51
Binary files /dev/null and b/bin/ls differ
diff --git a/bin/test b/bin/test
new file mode 100755
index 0000000..0cced79
Binary files /dev/null and b/bin/test differ

It seems like git2, and possibly libgit2, are not detecting binary files in the same manner as the git CLI is doing.

I checked on git2-0.17.0 and git2-018.1 and my git version is git version 2.40.1.

Let me know if I can do anything else to help track down this discrepancy.

@extrawurst
Copy link
Contributor

and possibly libgit2

then its probably better to post the repro there

@FintanH
Copy link
Author

FintanH commented Sep 22, 2023

and possibly libgit2

then its probably better to post the repro there

Thanks for the response, you're right. My C is rusty (pun intended), so it was quicker for me to write a reproducible in Rust first -- and since this library directly relies on the behaviour of libgit2 I thought it would be in this project's interest to know about the potential bug too :)

@extrawurst
Copy link
Contributor

people post the git2-rs based rust repros there too, don't be shy :)

@ehuss
Copy link
Contributor

ehuss commented Sep 22, 2023

The main.rs in the repo only prints "Hello, world!". Is it perhaps missing the reproduction code?

@FintanH
Copy link
Author

FintanH commented Sep 22, 2023

Ah sorry! I did forget to push the changes, but they're there now, thanks 馃檱

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants