libgit2 / objective-git

Objective-C bindings to libgit2
MIT License
1.16k stars 280 forks source link

Diffs do not support non-UTF8 content #195

Open jspahrsummers opened 11 years ago

jspahrsummers commented 11 years ago

For example, fetching the diff for graphics.ai in mhettler/accuratelockandhardware.com@4e77bd2ff0775d592175afe73586d0751891be00 will result in many nil hunk headers and lines.

libgit2 is giving us valid C strings — at least in the sense that they represent the file's content, but may be in an unknown encoding. We should use Cocoa's text encoding functions or implement some fallbacks to handle more possible cases.

alanjrogers commented 11 years ago

Those are Adobe illustrator files, so they really should be treated as binary.

jspahrsummers commented 11 years ago

@alanjrogers Core git doesn't treat them that way either, for whatever reason, though that doesn't mean we can't.

arrbee commented 11 years ago

Core git has a --binary flag that you can pass to diff to get binary diffs instead of line-oriented text diffs. I'm not actually sure what it does differently in that case - let me check it out.