Skip to content

Commit fa1a4c7

Browse files
committed
blob: deprecate git_blob_filtered_content
Users should now use `git_blob_filter`.
1 parent a008cee commit fa1a4c7

File tree

3 files changed

+23
-35
lines changed

3 files changed

+23
-35
lines changed

include/git2/blob.h

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -145,25 +145,6 @@ GIT_EXTERN(int) git_blob_filter(
145145
const char *as_path,
146146
git_blob_filter_options *opts);
147147

148-
/**
149-
* Get a buffer with the filtered content of a blob. This is
150-
* equivalent to calling `git_blob_filter`, with the only possible
151-
* option being the binary check.
152-
*
153-
* @see git_blob_filter
154-
* @param out The git_buf to be filled in
155-
* @param blob Pointer to the blob
156-
* @param as_path Path used for file attribute lookups, etc.
157-
* @param check_for_binary_data Should this test if blob content contains
158-
* NUL bytes / looks like binary data before applying filters?
159-
* @return 0 on success or an error code
160-
*/
161-
GIT_EXTERN(int) git_blob_filtered_content(
162-
git_buf *out,
163-
git_blob *blob,
164-
const char *as_path,
165-
int check_for_binary_data);
166-
167148
/**
168149
* Read a file from the working folder of a repository
169150
* and write it to the Object Database as a loose blob

include/git2/deprecated.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,13 @@ GIT_EXTERN(int) git_blob_create_fromstream_commit(
9090
GIT_EXTERN(int) git_blob_create_frombuffer(
9191
git_oid *id, git_repository *repo, const void *buffer, size_t len);
9292

93+
/** Deprecated in favor of @see git_blob_filter */
94+
GIT_EXTERN(int) git_blob_filtered_content(
95+
git_buf *out,
96+
git_blob *blob,
97+
const char *as_path,
98+
int check_for_binary_data);
99+
93100
/**@}*/
94101

95102
/** @name Deprecated Buffer Functions

src/blob.c

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -437,22 +437,6 @@ int git_blob_filter(
437437
return error;
438438
}
439439

440-
int git_blob_filtered_content(
441-
git_buf *out,
442-
git_blob *blob,
443-
const char *path,
444-
int check_for_binary_data)
445-
{
446-
git_blob_filter_options opts = GIT_BLOB_FILTER_OPTIONS_INIT;
447-
448-
if (check_for_binary_data)
449-
opts.flags |= GIT_BLOB_FILTER_CHECK_FOR_BINARY;
450-
else
451-
opts.flags &= ~GIT_BLOB_FILTER_CHECK_FOR_BINARY;
452-
453-
return git_blob_filter(out, blob, path, &opts);
454-
}
455-
456440
/* Deprecated functions */
457441

458442
int git_blob_create_frombuffer(
@@ -485,3 +469,19 @@ int git_blob_create_fromstream_commit(
485469
{
486470
return git_blob_create_from_stream_commit(out, stream);
487471
}
472+
473+
int git_blob_filtered_content(
474+
git_buf *out,
475+
git_blob *blob,
476+
const char *path,
477+
int check_for_binary_data)
478+
{
479+
git_blob_filter_options opts = GIT_BLOB_FILTER_OPTIONS_INIT;
480+
481+
if (check_for_binary_data)
482+
opts.flags |= GIT_BLOB_FILTER_CHECK_FOR_BINARY;
483+
else
484+
opts.flags &= ~GIT_BLOB_FILTER_CHECK_FOR_BINARY;
485+
486+
return git_blob_filter(out, blob, path, &opts);
487+
}

0 commit comments

Comments
 (0)