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
e35b5e44
Commit
e35b5e44
authored
Feb 21, 2022
by
Carlos Martín Nieto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
test: add test for the behaviour of update_tips on error
parent
15860aa0
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
41 additions
and
0 deletions
+41
-0
tests/network/fetchlocal.c
+41
-0
No files found.
tests/network/fetchlocal.c
View file @
e35b5e44
...
...
@@ -509,3 +509,44 @@ void test_network_fetchlocal__prune_load_fetch_prune_config(void)
git_remote_free
(
origin
);
git_repository_free
(
repo
);
}
static
int
update_tips_error
(
const
char
*
ref
,
const
git_oid
*
old
,
const
git_oid
*
new
,
void
*
data
)
{
int
*
callcount
=
(
int
*
)
data
;
GIT_UNUSED
(
ref
);
GIT_UNUSED
(
old
);
GIT_UNUSED
(
new
);
(
*
callcount
)
++
;
return
-
1
;
}
void
test_network_fetchlocal__update_tips_error_is_propagated
(
void
)
{
git_repository
*
repo
;
git_reference_iterator
*
iterator
;
git_reference
*
ref
;
git_remote
*
remote
;
git_fetch_options
options
=
GIT_FETCH_OPTIONS_INIT
;
int
callcount
=
0
;
cl_git_pass
(
git_repository_init
(
&
repo
,
"foo.git"
,
true
));
cl_set_cleanup
(
cleanup_local_repo
,
"foo.git"
);
cl_git_pass
(
git_remote_create_with_fetchspec
(
&
remote
,
repo
,
"origin"
,
cl_git_fixture_url
(
"testrepo.git"
),
"+refs/heads/*:refs/remotes/update-tips/*"
));
options
.
callbacks
.
update_tips
=
update_tips_error
;
options
.
callbacks
.
payload
=
&
callcount
;
cl_git_fail
(
git_remote_fetch
(
remote
,
NULL
,
&
options
,
NULL
));
cl_assert_equal_i
(
1
,
callcount
);
cl_git_pass
(
git_reference_iterator_glob_new
(
&
iterator
,
repo
,
"refs/remotes/update-tips/**/"
));
cl_assert_equal_i
(
GIT_ITEROVER
,
git_reference_next
(
&
ref
,
iterator
));
git_reference_iterator_free
(
iterator
);
git_remote_free
(
remote
);
git_repository_free
(
repo
);
}
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