diff options
author | nulltoken <emeric.fermas@gmail.com> | 2012-12-17 15:15:20 +0100 |
---|---|---|
committer | nulltoken <emeric.fermas@gmail.com> | 2012-12-17 17:20:31 +0100 |
commit | a3337f10bb604fce96e185088411feab53ab3d64 (patch) | |
tree | 5466c9bb51e54e540b0a277b8ce7cce9e285a8d7 /include/git2/blob.h | |
parent | bdb94c21fd995da8c5b83ba30500996b3397bf3a (diff) | |
download | libgit2-a3337f10bb604fce96e185088411feab53ab3d64.tar.gz |
blob: introduce git_blob_is_binary()
Diffstat (limited to 'include/git2/blob.h')
-rw-r--r-- | include/git2/blob.h | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/include/git2/blob.h b/include/git2/blob.h index a68c78b5a..30055b614 100644 --- a/include/git2/blob.h +++ b/include/git2/blob.h @@ -183,6 +183,19 @@ GIT_EXTERN(int) git_blob_create_fromchunks( */ GIT_EXTERN(int) git_blob_create_frombuffer(git_oid *oid, git_repository *repo, const void *buffer, size_t len); +/** + * Determine if the blob content is most certainly binary or not. + * + * The heuristic used to guess if a file is binary is taken from core git: + * Searching for NUL bytes and looking for a reasonable ratio of printable + * to non-printable characters among the first 4000 bytes. + * + * @param blob The blob which content should be analyzed + * @return 1 if the content of the blob is detected + * as binary; 0 otherwise. + */ +GIT_EXTERN(int) git_blob_is_binary(git_blob *blob); + /** @} */ GIT_END_DECL #endif |