summaryrefslogtreecommitdiff
path: root/include/git2/blob.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/git2/blob.h')
-rw-r--r--include/git2/blob.h13
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