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
1e64a446
Commit
1e64a446
authored
Dec 02, 2016
by
Carlos Martín Nieto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fetch: expand fetchhead test to cover providing multiple refspecs
parent
a8f19f81
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
8 deletions
+16
-8
tests/fetchhead/nonetwork.c
+16
-8
No files found.
tests/fetchhead/nonetwork.c
View file @
1e64a446
...
...
@@ -353,20 +353,25 @@ void test_fetchhead_nonetwork__quote_in_branch_name(void)
}
static
bool
found_master
;
static
bool
find_master_called
;
static
bool
found_haacked
;
static
bool
find_master_haacked_called
;
int
find_master
(
const
char
*
ref_name
,
const
char
*
remote_url
,
const
git_oid
*
oid
,
unsigned
int
is_merge
,
void
*
payload
)
int
find_master
_haacked
(
const
char
*
ref_name
,
const
char
*
remote_url
,
const
git_oid
*
oid
,
unsigned
int
is_merge
,
void
*
payload
)
{
GIT_UNUSED
(
remote_url
);
GIT_UNUSED
(
oid
);
GIT_UNUSED
(
payload
);
find_master_called
=
true
;
find_master_
haacked_
called
=
true
;
if
(
!
strcmp
(
"refs/heads/master"
,
ref_name
))
{
cl_assert
(
is_merge
);
found_master
=
true
;
}
if
(
!
strcmp
(
"refs/heads/haacked"
,
ref_name
))
{
cl_assert
(
is_merge
);
found_haacked
=
true
;
}
return
0
;
}
...
...
@@ -375,10 +380,12 @@ void test_fetchhead_nonetwork__create_when_refpecs_given(void)
{
git_remote
*
remote
;
git_buf
path
=
GIT_BUF_INIT
;
char
*
refspec
=
"refs/heads/master"
;
char
*
refspec1
=
"refs/heads/master"
;
char
*
refspec2
=
"refs/heads/haacked"
;
char
*
refspecs
[]
=
{
refspec1
,
refspec2
};
git_strarray
specs
=
{
&
refspec
,
1
,
refspecs
,
2
,
};
cl_set_cleanup
(
&
cleanup_repository
,
"./test1"
);
...
...
@@ -391,9 +398,10 @@ void test_fetchhead_nonetwork__create_when_refpecs_given(void)
cl_git_pass
(
git_remote_fetch
(
remote
,
&
specs
,
NULL
,
NULL
));
cl_assert
(
git_path_exists
(
path
.
ptr
));
cl_git_pass
(
git_repository_fetchhead_foreach
(
g_repo
,
find_master
,
NULL
));
cl_assert
(
find_master_called
);
cl_git_pass
(
git_repository_fetchhead_foreach
(
g_repo
,
find_master
_haacked
,
NULL
));
cl_assert
(
find_master_
haacked_
called
);
cl_assert
(
found_master
);
cl_assert
(
found_haacked
);
git_remote_free
(
remote
);
git_buf_free
(
&
path
);
...
...
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