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
42385c96
Commit
42385c96
authored
Feb 05, 2013
by
Ben Straub
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Enhance test coverage for transfer cancellation
parent
b71bac9d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
0 deletions
+22
-0
tests-clar/online/fetch.c
+22
-0
No files found.
tests-clar/online/fetch.c
View file @
42385c96
...
...
@@ -112,3 +112,25 @@ void test_online_fetch__doesnt_retrieve_a_pack_when_the_repository_is_up_to_date
git_remote_free
(
remote
);
git_repository_free
(
_repository
);
}
static
int
cancel_at_half
(
const
git_transfer_progress
*
stats
,
void
*
payload
)
{
GIT_UNUSED
(
payload
);
if
(
stats
->
received_objects
>
(
stats
->
total_objects
/
2
))
return
-
1
;
return
0
;
}
void
test_online_fetch__can_cancel
(
void
)
{
git_remote
*
remote
;
size_t
bytes_received
=
0
;
cl_git_pass
(
git_remote_create
(
&
remote
,
_repo
,
"test"
,
"http://github.com/libgit2/TestGitRepository.git"
));
cl_git_pass
(
git_remote_connect
(
remote
,
GIT_DIRECTION_FETCH
));
cl_git_fail_with
(
git_remote_download
(
remote
,
cancel_at_half
,
&
bytes_received
),
GIT_EUSER
);
git_remote_disconnect
(
remote
);
git_remote_free
(
remote
);
}
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