diff options
author | Russell Belfer <rb@github.com> | 2013-01-11 11:24:26 -0800 |
---|---|---|
committer | Russell Belfer <rb@github.com> | 2013-01-11 11:24:26 -0800 |
commit | 0d65acade84a5ff2421cd52de82a8963f004d481 (patch) | |
tree | 5c1f0ba04710e32642e32a4cadf7a8e14dc0aba6 /src/buf_text.h | |
parent | d0b14cea0e1ff09af83a801c1a9cf1a431d46d0c (diff) | |
download | libgit2-0d65acade84a5ff2421cd52de82a8963f004d481.tar.gz |
Match binary file check of core git in diff
Core git just looks for NUL bytes in files when deciding about
is-binary inside diff (although it uses a better algorithm in
checkout, when deciding if CRLF conversion should be done).
Libgit2 was using the better algorithm in both places, but that
is causing some confusion. For now, this makes diff just look
for NUL bytes to decide if a file is binary by content in diff.
Diffstat (limited to 'src/buf_text.h')
-rw-r--r-- | src/buf_text.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/buf_text.h b/src/buf_text.h index ae5e6ca30..458ee33c9 100644 --- a/src/buf_text.h +++ b/src/buf_text.h @@ -71,6 +71,14 @@ extern int git_buf_text_common_prefix(git_buf *buf, const git_strarray *strs); extern bool git_buf_text_is_binary(const git_buf *buf); /** + * Check quickly if buffer contains a NUL byte + * + * @param buf Buffer to check + * @return true if buffer contains a NUL byte + */ +extern bool git_buf_text_contains_nul(const git_buf *buf); + +/** * Check if a buffer begins with a UTF BOM * * @param bom Set to the type of BOM detected or GIT_BOM_NONE |