Mismatched binary detection behaviour on diffs
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 2.1k
- Forks
- 450
- Avg merge
- 11m
- Merged PRs (30d)
- 1
Description
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.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by cloning the linked git2-binary-check repository and run cargo run, then compare its output with git diff 373b3404371e359404392aff715d504293112c8b abdedcec89e3c48ac520e4a96c7ea39364316b9e. Investigate the binary-detection behavior in git2/libgit2 using git2-0.17.0, git2-0.18.1, and Git 2.40.1; done means the discrepancy is explained and detection behavior is aligned or clearly documented.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- git, rust
- Domain
- devtools
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100