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
c089d5ac
Commit
c089d5ac
authored
Aug 27, 2021
by
Edward Thomson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
filter: use streaming filters in tests
parent
f593fa97
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
36 additions
and
3 deletions
+36
-3
tests/filter/custom_helpers.c
+24
-2
tests/filter/wildcard.c
+12
-1
No files found.
tests/filter/custom_helpers.c
View file @
c089d5ac
...
@@ -37,6 +37,17 @@ int bitflip_filter_apply(
...
@@ -37,6 +37,17 @@ int bitflip_filter_apply(
return
0
;
return
0
;
}
}
static
int
bitflip_filter_stream
(
git_writestream
**
out
,
git_filter
*
self
,
void
**
payload
,
const
git_filter_source
*
src
,
git_writestream
*
next
)
{
return
git_filter_buffered_stream_new
(
out
,
self
,
bitflip_filter_apply
,
NULL
,
payload
,
src
,
next
);
}
static
void
bitflip_filter_free
(
git_filter
*
f
)
static
void
bitflip_filter_free
(
git_filter
*
f
)
{
{
git__free
(
f
);
git__free
(
f
);
...
@@ -50,7 +61,7 @@ git_filter *create_bitflip_filter(void)
...
@@ -50,7 +61,7 @@ git_filter *create_bitflip_filter(void)
filter
->
version
=
GIT_FILTER_VERSION
;
filter
->
version
=
GIT_FILTER_VERSION
;
filter
->
attributes
=
"+bitflip"
;
filter
->
attributes
=
"+bitflip"
;
filter
->
shutdown
=
bitflip_filter_free
;
filter
->
shutdown
=
bitflip_filter_free
;
filter
->
apply
=
bitflip_filter_apply
;
filter
->
stream
=
bitflip_filter_stream
;
return
filter
;
return
filter
;
}
}
...
@@ -88,6 +99,17 @@ int reverse_filter_apply(
...
@@ -88,6 +99,17 @@ int reverse_filter_apply(
return
0
;
return
0
;
}
}
static
int
reverse_filter_stream
(
git_writestream
**
out
,
git_filter
*
self
,
void
**
payload
,
const
git_filter_source
*
src
,
git_writestream
*
next
)
{
return
git_filter_buffered_stream_new
(
out
,
self
,
reverse_filter_apply
,
NULL
,
payload
,
src
,
next
);
}
static
void
reverse_filter_free
(
git_filter
*
f
)
static
void
reverse_filter_free
(
git_filter
*
f
)
{
{
git__free
(
f
);
git__free
(
f
);
...
@@ -101,7 +123,7 @@ git_filter *create_reverse_filter(const char *attrs)
...
@@ -101,7 +123,7 @@ git_filter *create_reverse_filter(const char *attrs)
filter
->
version
=
GIT_FILTER_VERSION
;
filter
->
version
=
GIT_FILTER_VERSION
;
filter
->
attributes
=
attrs
;
filter
->
attributes
=
attrs
;
filter
->
shutdown
=
reverse_filter_free
;
filter
->
shutdown
=
reverse_filter_free
;
filter
->
apply
=
reverse_filter_apply
;
filter
->
stream
=
reverse_filter_stream
;
return
filter
;
return
filter
;
}
}
...
...
tests/filter/wildcard.c
View file @
c089d5ac
...
@@ -93,6 +93,17 @@ static int wildcard_filter_apply(
...
@@ -93,6 +93,17 @@ static int wildcard_filter_apply(
return
GIT_PASSTHROUGH
;
return
GIT_PASSTHROUGH
;
}
}
static
int
wildcard_filter_stream
(
git_writestream
**
out
,
git_filter
*
self
,
void
**
payload
,
const
git_filter_source
*
src
,
git_writestream
*
next
)
{
return
git_filter_buffered_stream_new
(
out
,
self
,
wildcard_filter_apply
,
NULL
,
payload
,
src
,
next
);
}
static
void
wildcard_filter_cleanup
(
git_filter
*
self
,
void
*
payload
)
static
void
wildcard_filter_cleanup
(
git_filter
*
self
,
void
*
payload
)
{
{
GIT_UNUSED
(
self
);
GIT_UNUSED
(
self
);
...
@@ -112,7 +123,7 @@ static git_filter *create_wildcard_filter(void)
...
@@ -112,7 +123,7 @@ static git_filter *create_wildcard_filter(void)
filter
->
version
=
GIT_FILTER_VERSION
;
filter
->
version
=
GIT_FILTER_VERSION
;
filter
->
attributes
=
"filter=*"
;
filter
->
attributes
=
"filter=*"
;
filter
->
check
=
wildcard_filter_check
;
filter
->
check
=
wildcard_filter_check
;
filter
->
apply
=
wildcard_filter_apply
;
filter
->
stream
=
wildcard_filter_stream
;
filter
->
cleanup
=
wildcard_filter_cleanup
;
filter
->
cleanup
=
wildcard_filter_cleanup
;
filter
->
shutdown
=
wildcard_filter_free
;
filter
->
shutdown
=
wildcard_filter_free
;
...
...
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