diff options
author | Edward Thomson <ethomson@github.com> | 2021-12-10 15:19:59 -0500 |
---|---|---|
committer | Edward Thomson <ethomson@github.com> | 2021-12-10 15:19:59 -0500 |
commit | 4591e76a2d1aa07dc80eaa002b4ed7c58d81c242 (patch) | |
tree | f5d52ac80a531b5be879c450c179d1172b97e2e4 /src | |
parent | 12b53eb0318b0529514ad7e318de70b8325d43f2 (diff) | |
download | libgit2-ethomson/blob_data_is_binary.tar.gz |
blob: identify binary contentethomson/blob_data_is_binary
Introduce `git_blob_data_is_binary` to examine a blob's data, instead of
the blob itself. A replacement for `git_buf_is_binary`.
Diffstat (limited to 'src')
-rw-r--r-- | src/blob.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/blob.c b/src/blob.c index 65841ab03..19ce8b3b5 100644 --- a/src/blob.c +++ b/src/blob.c @@ -404,6 +404,15 @@ int git_blob_is_binary(const git_blob *blob) return git_str_is_binary(&content); } +int git_blob_data_is_binary(const char *str, size_t len) +{ + git_str content = GIT_STR_INIT; + + git_str_attach_notowned(&content, str, len); + + return git_str_is_binary(&content); +} + int git_blob_filter_options_init( git_blob_filter_options *opts, unsigned int version) |