Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
git2
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lvzhengyang
git2
Commits
27e34f9b
Unverified
Commit
27e34f9b
authored
Jan 06, 2021
by
Edward Thomson
Committed by
GitHub
Jan 06, 2021
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #5759 from JoshuaS3/master
Add documentation for git_blob_filter_options.version
parents
f0d7922c
ddafbafe
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
30 additions
and
0 deletions
+30
-0
include/git2/blob.h
+16
-0
src/blob.c
+9
-0
tests/core/structinit.c
+5
-0
No files found.
include/git2/blob.h
View file @
27e34f9b
...
@@ -118,6 +118,10 @@ typedef enum {
...
@@ -118,6 +118,10 @@ typedef enum {
/**
/**
* The options used when applying filter options to a file.
* The options used when applying filter options to a file.
*
* Initialize with `GIT_BLOB_FILTER_OPTIONS_INIT`. Alternatively, you can
* use `git_blob_filter_options_init`.
*
*/
*/
typedef
struct
{
typedef
struct
{
int
version
;
int
version
;
...
@@ -130,6 +134,18 @@ typedef struct {
...
@@ -130,6 +134,18 @@ typedef struct {
#define GIT_BLOB_FILTER_OPTIONS_INIT {GIT_BLOB_FILTER_OPTIONS_VERSION, GIT_BLOB_FILTER_CHECK_FOR_BINARY}
#define GIT_BLOB_FILTER_OPTIONS_INIT {GIT_BLOB_FILTER_OPTIONS_VERSION, GIT_BLOB_FILTER_CHECK_FOR_BINARY}
/**
/**
* Initialize git_blob_filter_options structure
*
* Initializes a `git_blob_filter_options` with default values. Equivalent
* to creating an instance with `GIT_BLOB_FILTER_OPTIONS_INIT`.
*
* @param opts The `git_blob_filter_options` struct to initialize.
* @param version The struct version; pass `GIT_BLOB_FILTER_OPTIONS_VERSION`.
* @return Zero on success; -1 on failure.
*/
GIT_EXTERN
(
int
)
git_blob_filter_options_init
(
git_blob_filter_options
*
opts
,
unsigned
int
version
);
/**
* Get a buffer with the filtered content of a blob.
* Get a buffer with the filtered content of a blob.
*
*
* This applies filters as if the blob was being checked out to the
* This applies filters as if the blob was being checked out to the
...
...
src/blob.c
View file @
27e34f9b
...
@@ -408,6 +408,15 @@ int git_blob_is_binary(const git_blob *blob)
...
@@ -408,6 +408,15 @@ int git_blob_is_binary(const git_blob *blob)
return
git_buf_text_is_binary
(
&
content
);
return
git_buf_text_is_binary
(
&
content
);
}
}
int
git_blob_filter_options_init
(
git_blob_filter_options
*
opts
,
unsigned
int
version
)
{
GIT_INIT_STRUCTURE_FROM_TEMPLATE
(
opts
,
version
,
git_blob_filter_options
,
GIT_BLOB_FILTER_OPTIONS_INIT
);
return
0
;
}
int
git_blob_filter
(
int
git_blob_filter
(
git_buf
*
out
,
git_buf
*
out
,
git_blob
*
blob
,
git_blob
*
blob
,
...
...
tests/core/structinit.c
View file @
27e34f9b
...
@@ -82,6 +82,11 @@ void test_core_structinit__compare(void)
...
@@ -82,6 +82,11 @@ void test_core_structinit__compare(void)
git_blame_options
,
GIT_BLAME_OPTIONS_VERSION
,
\
git_blame_options
,
GIT_BLAME_OPTIONS_VERSION
,
\
GIT_BLAME_OPTIONS_INIT
,
git_blame_options_init
);
GIT_BLAME_OPTIONS_INIT
,
git_blame_options_init
);
/* blob_filter_options */
CHECK_MACRO_FUNC_INIT_EQUAL
(
\
git_blob_filter_options
,
GIT_BLOB_FILTER_OPTIONS_VERSION
,
\
GIT_BLOB_FILTER_OPTIONS_INIT
,
git_blob_filter_options_init
);
/* checkout */
/* checkout */
CHECK_MACRO_FUNC_INIT_EQUAL
(
\
CHECK_MACRO_FUNC_INIT_EQUAL
(
\
git_checkout_options
,
GIT_CHECKOUT_OPTIONS_VERSION
,
\
git_checkout_options
,
GIT_CHECKOUT_OPTIONS_VERSION
,
\
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment