Commit fa1a4c77f5f2c504f900035496e1b483acac412b

Edward Thomson 2019-07-21T11:03:01

blob: deprecate `git_blob_filtered_content` Users should now use `git_blob_filter`.

diff --git a/include/git2/blob.h b/include/git2/blob.h
index be721ed..3710f41 100644
--- a/include/git2/blob.h
+++ b/include/git2/blob.h
@@ -146,25 +146,6 @@ GIT_EXTERN(int) git_blob_filter(
 	git_blob_filter_options *opts);
 
 /**
- * Get a buffer with the filtered content of a blob.  This is
- * equivalent to calling `git_blob_filter`, with the only possible
- * option being the binary check.
- *
- * @see git_blob_filter
- * @param out The git_buf to be filled in
- * @param blob Pointer to the blob
- * @param as_path Path used for file attribute lookups, etc.
- * @param check_for_binary_data Should this test if blob content contains
- *        NUL bytes / looks like binary data before applying filters?
- * @return 0 on success or an error code
- */
-GIT_EXTERN(int) git_blob_filtered_content(
-	git_buf *out,
-	git_blob *blob,
-	const char *as_path,
-	int check_for_binary_data);
-
-/**
  * Read a file from the working folder of a repository
  * and write it to the Object Database as a loose blob
  *
diff --git a/include/git2/deprecated.h b/include/git2/deprecated.h
index fec56b1..1abfd50 100644
--- a/include/git2/deprecated.h
+++ b/include/git2/deprecated.h
@@ -90,6 +90,13 @@ GIT_EXTERN(int) git_blob_create_fromstream_commit(
 GIT_EXTERN(int) git_blob_create_frombuffer(
 	git_oid *id, git_repository *repo, const void *buffer, size_t len);
 
+/** Deprecated in favor of @see git_blob_filter */
+GIT_EXTERN(int) git_blob_filtered_content(
+	git_buf *out,
+	git_blob *blob,
+	const char *as_path,
+	int check_for_binary_data);
+
 /**@}*/
 
 /** @name Deprecated Buffer Functions
diff --git a/src/blob.c b/src/blob.c
index efc9fc8..1af3131 100644
--- a/src/blob.c
+++ b/src/blob.c
@@ -437,22 +437,6 @@ int git_blob_filter(
 	return error;
 }
 
-int git_blob_filtered_content(
-	git_buf *out,
-	git_blob *blob,
-	const char *path,
-	int check_for_binary_data)
-{
-	git_blob_filter_options opts = GIT_BLOB_FILTER_OPTIONS_INIT;
-
-	if (check_for_binary_data)
-		opts.flags |= GIT_BLOB_FILTER_CHECK_FOR_BINARY;
-	else
-		opts.flags &= ~GIT_BLOB_FILTER_CHECK_FOR_BINARY;
-
-	return git_blob_filter(out, blob, path, &opts);
-}
-
 /* Deprecated functions */
 
 int git_blob_create_frombuffer(
@@ -485,3 +469,19 @@ int git_blob_create_fromstream_commit(
 {
 	return git_blob_create_from_stream_commit(out, stream);
 }
+
+int git_blob_filtered_content(
+	git_buf *out,
+	git_blob *blob,
+	const char *path,
+	int check_for_binary_data)
+{
+	git_blob_filter_options opts = GIT_BLOB_FILTER_OPTIONS_INIT;
+
+	if (check_for_binary_data)
+		opts.flags |= GIT_BLOB_FILTER_CHECK_FOR_BINARY;
+	else
+		opts.flags &= ~GIT_BLOB_FILTER_CHECK_FOR_BINARY;
+
+	return git_blob_filter(out, blob, path, &opts);
+}