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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

False positive binary file #61

Closed
jebaum opened this issue Feb 1, 2016 · 4 comments
Closed

False positive binary file #61

jebaum opened this issue Feb 1, 2016 · 4 comments

Comments

@jebaum
Copy link
Contributor

jebaum commented Feb 1, 2016

First of all, awesome plugin! It's already making my life way more pleasant.

When I made a small change to my zshrc (viewable here: https://gist.github.com/anonymous/59dde6c409a776f8d18e), vimagit detected it as a binary file and didn't show a diff. This is due to the characters in quotes on lines 144 and 151. These characters aren't viewable in a web browser as far as I know, but you can see them if you download the raw file from the gist and open it in vim.

Removing those characters from the file causes the diff to show up in vimagit.

@jreybert
Copy link
Owner

jreybert commented Feb 1, 2016

Hi jebaum,

thanks for your enthusiasm about vimagit!

I already encountered this false positive, on a vim config file :)

As vim does not embed function do detect binary file, I must use file Unix command. If file returns a wrong result, I don't know how to perform a better guess than him.

This is indubitably a bug, but for now I don't see how to resolve it.

@jebaum
Copy link
Contributor Author

jebaum commented Feb 1, 2016

I didn't realize file was identifying it as binary. Interesting. A potential workaround could be checking the output of git diff for a file and seeing if it has a textual diff or if git says it's a binary one. Not sure how much work that would be, or how much it might hurt performance. If you don't think that's a good solution, I'll look into this to see if there are more robust ways to detect binary vs text.

@jreybert
Copy link
Owner

jreybert commented Feb 1, 2016

I though about using git for this job. I was just worrying about different languages, but it should be possible to force language (it should also work for OSX and windows). Actually, use git could also fix #60 !

I'll take a look for it soon. If you want to contribute, help yourself :)

jreybert added a commit that referenced this issue Feb 8, 2016
…diff parsing (fix #60, #61)

for the moment, git diff output is not localized in case of binary detection
@jreybert
Copy link
Owner

jreybert commented Feb 8, 2016

Hi @jebaum , could you please try the dev/git_diff branch and confirm that it fixes your problem?

@jreybert jreybert added this to the Release 1.5.2 milestone Feb 8, 2016
jreybert added a commit that referenced this issue Feb 8, 2016
…diff parsing (fix #60, #61)

for the moment, git diff output is not localized in case of binary detection
jreybert added a commit that referenced this issue Feb 9, 2016
…diff parsing (fix #60, #61)

for the moment, git diff output is not localized in case of binary detection
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants