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 /include/git2/blob.h | |
parent | 12b53eb0318b0529514ad7e318de70b8325d43f2 (diff) | |
download | libgit2-4591e76a2d1aa07dc80eaa002b4ed7c58d81c242.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 'include/git2/blob.h')
-rw-r--r-- | include/git2/blob.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/include/git2/blob.h b/include/git2/blob.h index 4922b087a..59fac9e20 100644 --- a/include/git2/blob.h +++ b/include/git2/blob.h @@ -285,6 +285,18 @@ GIT_EXTERN(int) git_blob_create_from_buffer( GIT_EXTERN(int) git_blob_is_binary(const git_blob *blob); /** + * Determine if the given content is most certainly binary or not; + * this is the same mechanism used by `git_blob_is_binary` but only + * looking at raw data. + * + * @param data The blob data which content should be analyzed + * @param len The length of the data + * @return 1 if the content of the blob is detected + * as binary; 0 otherwise. + */ +GIT_EXTERN(int) git_blob_data_is_binary(const char *data, size_t len); + +/** * Create an in-memory copy of a blob. The copy must be explicitly * free'd or it will leak. * |