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
2775d1cb
Commit
2775d1cb
authored
Nov 29, 2012
by
Vicent Martí
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1102 from nulltoken/topic/fetch-test-coverage
fetch: enhance test coverage
parents
3ae550e3
046a1573
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
34 additions
and
1 deletions
+34
-1
tests-clar/network/fetch.c
+34
-1
No files found.
tests-clar/network/fetch.c
View file @
2775d1cb
...
...
@@ -33,7 +33,7 @@ static void progress(const git_transfer_progress *stats, void *payload)
*
bytes_received
=
stats
->
received_bytes
;
}
static
void
do_fetch
(
const
char
*
url
,
in
t
flag
,
int
n
)
static
void
do_fetch
(
const
char
*
url
,
git_remote_autotag_option_
t
flag
,
int
n
)
{
git_remote
*
remote
;
git_remote_callbacks
callbacks
;
...
...
@@ -75,3 +75,36 @@ void test_network_fetch__no_tags_http(void)
{
do_fetch
(
"http://github.com/libgit2/TestGitRepository.git"
,
GIT_REMOTE_DOWNLOAD_TAGS_NONE
,
3
);
}
static
void
transferProgressCallback
(
const
git_transfer_progress
*
stats
,
void
*
payload
)
{
bool
*
invoked
=
(
bool
*
)
payload
;
*
invoked
=
true
;
}
void
test_network_fetch__doesnt_retrieve_a_pack_when_the_repository_is_up_to_date
(
void
)
{
git_repository
*
_repository
;
git_remote
*
remote
;
bool
invoked
=
false
;
cl_git_pass
(
git_clone_bare
(
&
_repository
,
"https://github.com/libgit2/TestGitRepository.git"
,
"./fetch/lg2"
,
NULL
,
NULL
));
git_repository_free
(
_repository
);
cl_git_pass
(
git_repository_open
(
&
_repository
,
"./fetch/lg2"
));
cl_git_pass
(
git_remote_load
(
&
remote
,
_repository
,
"origin"
));
cl_git_pass
(
git_remote_connect
(
remote
,
GIT_DIRECTION_FETCH
));
cl_assert_equal_i
(
false
,
invoked
);
cl_git_pass
(
git_remote_download
(
remote
,
&
transferProgressCallback
,
&
invoked
));
cl_assert_equal_i
(
false
,
invoked
);
cl_git_pass
(
git_remote_update_tips
(
remote
));
git_remote_disconnect
(
remote
);
git_remote_free
(
remote
);
git_repository_free
(
_repository
);
}
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