diff options
author | Vicent Martà <vicent@github.com> | 2013-01-11 11:35:09 -0800 |
---|---|---|
committer | Vicent Martà <vicent@github.com> | 2013-01-11 11:35:09 -0800 |
commit | 160e4fb792b070e14c7094893e390c53d788648c (patch) | |
tree | f5a999ef69d8ec8e8616d4a7b8b113b1f0522aa3 /src/diff_output.c | |
parent | 6e19edaa40559a53b8fbf544fe0a6d1f05096614 (diff) | |
parent | 0d65acade84a5ff2421cd52de82a8963f004d481 (diff) | |
download | libgit2-160e4fb792b070e14c7094893e390c53d788648c.tar.gz |
Merge pull request #1230 from arrbee/match-core-git-diff-binary-detection
Match binary file check of core git in diff
Diffstat (limited to 'src/diff_output.c')
-rw-r--r-- | src/diff_output.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/diff_output.c b/src/diff_output.c index d75a7bb94..933d44ee5 100644 --- a/src/diff_output.c +++ b/src/diff_output.c @@ -142,7 +142,12 @@ static int diff_delta_is_binary_by_content( GIT_UNUSED(ctxt); if ((file->flags & KNOWN_BINARY_FLAGS) == 0) { - if (git_buf_text_is_binary(&search)) + /* TODO: provide encoding / binary detection callbacks that can + * be UTF-8 aware, etc. For now, instead of trying to be smart, + * let's just use the simple NUL-byte detection that core git uses. + */ + /* previously was: if (git_buf_text_is_binary(&search)) */ + if (git_buf_text_contains_nul(&search)) file->flags |= GIT_DIFF_FILE_BINARY; else file->flags |= GIT_DIFF_FILE_NOT_BINARY; |