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
8296da5f
Commit
8296da5f
authored
Jun 14, 2017
by
Edward Thomson
Committed by
GitHub
Jun 14, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #4267 from mohseenrm/master
adding GIT_FILTER_VERSION to GIT_FILTER_INIT as part of convention
parents
4e257dab
a78441bc
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
24 additions
and
1 deletions
+24
-1
include/git2/sys/filter.h
+11
-0
src/filter.c
+7
-1
tests/core/structinit.c
+6
-0
No files found.
include/git2/sys/filter.h
View file @
8296da5f
...
@@ -271,6 +271,17 @@ struct git_filter {
...
@@ -271,6 +271,17 @@ struct git_filter {
};
};
#define GIT_FILTER_VERSION 1
#define GIT_FILTER_VERSION 1
#define GIT_FILTER_INIT {GIT_FILTER_VERSION}
/**
* Initializes a `git_filter` with default values. Equivalent to
* creating an instance with GIT_FILTER_INIT.
*
* @param filter the `git_filter` struct to initialize.
* @param version Version the struct; pass `GIT_FILTER_VERSION`
* @return Zero on success; -1 on failure.
*/
GIT_EXTERN
(
int
)
git_filter_init
(
git_filter
*
filter
,
unsigned
int
version
);
/**
/**
* Register a filter under a given name with a given priority.
* Register a filter under a given name with a given priority.
...
...
src/filter.c
View file @
8296da5f
...
@@ -895,7 +895,7 @@ static int stream_list_init(
...
@@ -895,7 +895,7 @@ static int stream_list_init(
git_array_size
(
filters
->
filters
)
-
1
-
i
:
i
;
git_array_size
(
filters
->
filters
)
-
1
-
i
:
i
;
git_filter_entry
*
fe
=
git_array_get
(
filters
->
filters
,
filter_idx
);
git_filter_entry
*
fe
=
git_array_get
(
filters
->
filters
,
filter_idx
);
git_writestream
*
filter_stream
;
git_writestream
*
filter_stream
;
assert
(
fe
->
filter
->
stream
||
fe
->
filter
->
apply
);
assert
(
fe
->
filter
->
stream
||
fe
->
filter
->
apply
);
/* If necessary, create a stream that proxies the traditional
/* If necessary, create a stream that proxies the traditional
...
@@ -1022,3 +1022,9 @@ int git_filter_list_stream_blob(
...
@@ -1022,3 +1022,9 @@ int git_filter_list_stream_blob(
return
git_filter_list_stream_data
(
filters
,
&
in
,
target
);
return
git_filter_list_stream_data
(
filters
,
&
in
,
target
);
}
}
int
git_filter_init
(
git_filter
*
filter
,
unsigned
int
version
)
{
GIT_INIT_STRUCTURE_FROM_TEMPLATE
(
filter
,
version
,
git_filter
,
GIT_FILTER_INIT
);
return
0
;
}
tests/core/structinit.c
View file @
8296da5f
#include "clar_libgit2.h"
#include "clar_libgit2.h"
#include <git2/sys/config.h>
#include <git2/sys/config.h>
#include <git2/sys/filter.h>
#include <git2/sys/odb_backend.h>
#include <git2/sys/odb_backend.h>
#include <git2/sys/refdb_backend.h>
#include <git2/sys/refdb_backend.h>
#include <git2/sys/transport.h>
#include <git2/sys/transport.h>
...
@@ -96,6 +97,11 @@ void test_core_structinit__compare(void)
...
@@ -96,6 +97,11 @@ void test_core_structinit__compare(void)
git_diff_find_options
,
GIT_DIFF_FIND_OPTIONS_VERSION
,
\
git_diff_find_options
,
GIT_DIFF_FIND_OPTIONS_VERSION
,
\
GIT_DIFF_FIND_OPTIONS_INIT
,
git_diff_find_init_options
);
GIT_DIFF_FIND_OPTIONS_INIT
,
git_diff_find_init_options
);
/* filter */
CHECK_MACRO_FUNC_INIT_EQUAL
(
\
git_filter
,
GIT_FILTER_VERSION
,
\
GIT_FILTER_INIT
,
git_filter_init
);
/* merge_file_input */
/* merge_file_input */
CHECK_MACRO_FUNC_INIT_EQUAL
(
\
CHECK_MACRO_FUNC_INIT_EQUAL
(
\
git_merge_file_input
,
GIT_MERGE_FILE_INPUT_VERSION
,
\
git_merge_file_input
,
GIT_MERGE_FILE_INPUT_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