From a3337f10bb604fce96e185088411feab53ab3d64 Mon Sep 17 00:00:00 2001 From: nulltoken Date: Mon, 17 Dec 2012 15:15:20 +0100 Subject: blob: introduce git_blob_is_binary() --- src/blob.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/blob.c') diff --git a/src/blob.c b/src/blob.c index b168df137..811bd850f 100644 --- a/src/blob.c +++ b/src/blob.c @@ -296,3 +296,15 @@ cleanup: git__free(content); return error; } + +int git_blob_is_binary(git_blob *blob) +{ + git_buf content; + + assert(blob); + + content.ptr = blob->odb_object->raw.data; + content.size = min(blob->odb_object->raw.len, 4000); + + return git_buf_text_is_binary(&content); +} -- cgit v1.2.1