-
Notifications
You must be signed in to change notification settings - Fork 29
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
Improve binary detection #1043
Improve binary detection #1043
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
8929afe
to
ad2c451
Compare
Visual diff results for latest changes ✅ There are no visual differences between |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we add a testcase for this?
libgit2 optimizes around not loading the content, when there's no content callbacks configured. So we aren't able to get a clear answer from radicle-surf if a file in a diff is a binary or not. A simple way without doing additional API requests is to check if the file type is a executable and if there are no hunks (since we don't get any deltas in binaries), this is a strong indicator for a binary. Signed-off-by: Sebastian Martinez <me@sebastinez.dev>
ad2c451
to
bd6ba78
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎉
libgit2 optimizes around not loading the content, when there's no content callbacks configured.
So we aren't able to get a clear answer from radicle-surf if a file in a diff is a binary or not.
A simple way without doing additional API requests is to check if the file type is a executable and if there are no hunks (since we don't get any deltas in binaries), this is a strong
indicator for a binary.
References:
libgit2/libgit2#6637 (comment)
rust-lang/git2-rs#991
Closes #1039