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’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Mismatched binary detection behaviour on diffs #6637
Comments
I haven't dug in here yet, but I suspect that this is an optimization around not loading the content when there's no content callbacks configured. See the documentation for
This is not the first time that I've been bitten by this. Probably this behavior should be optional. But in the meantime, if you wire up a callback do you get the expected behavior? |
Ya, you're right. When I added the call to diff.foreach(&mut |_, _| true, None, None, None).unwrap(); just before iterating over the deltas, I do get back that the binaries are true. |
OK, thanks for validating that. I'm going to keep this open because I want to change this behavior somehow. |
Appreciate that! |
Iterates over the git2::Diff entries to force libgit2 to do the binary detection. Also toggles the `skip_binary_check` in the `DiffOptions`. All this to workaround the libgit2 lazy flag setting[^0] [^0]: libgit2/libgit2#6637
Hey 👋
First off, apologies that this is via the
git2
crate, I'm better at Rust than I am C 😬 I also reported the issue on thegit2
repository rust-lang/git2-rs#991.Reproduction steps
If you clone this repository https://github.com/FintanH/git2-binary-check and do
cargo run
Expected behavior
I'll note here that
git diff 373b3404371e359404392aff715d504293112c8b abdedcec89e3c48ac520e4a96c7ea39364316b9e
will output:Actual behavior
Version of libgit2 (release number or SHA1)
I believe it's
v0.16.1
based off of this output:Operating system(s) tested
NixOS 23.05 (Stoat)
The text was updated successfully, but these errors were encountered: