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
ae297212
Commit
ae297212
authored
Nov 10, 2013
by
Carlos Martín Nieto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tests: update push tests
These tests were forgotten when modifying git_remote_ls().
parent
877cde76
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
23 additions
and
19 deletions
+23
-19
tests-clar/online/push.c
+4
-4
tests-clar/online/push_util.c
+14
-11
tests-clar/online/push_util.h
+5
-4
No files found.
tests-clar/online/push.c
View file @
ae297212
...
...
@@ -160,8 +160,6 @@ static void verify_refs(git_remote *remote, expected_ref expected_refs[], size_t
git_remote_ls
(
&
actual_refs
,
&
actual_refs_len
,
remote
);
verify_remote_refs
(
actual_refs
,
actual_refs_len
,
expected_refs
,
expected_refs_len
);
git_vector_free
(
&
actual_refs
);
}
static
int
tracking_branch_list_cb
(
const
char
*
branch_name
,
git_branch_t
branch_type
,
void
*
payload
)
...
...
@@ -265,7 +263,8 @@ failed:
void
test_online_push__initialize
(
void
)
{
git_vector
delete_specs
=
GIT_VECTOR_INIT
;
size_t
i
;
const
git_remote_head
**
heads
;
size_t
i
,
heads_len
;
char
*
curr_del_spec
;
_repo
=
cl_git_sandbox_init
(
"push_src"
);
...
...
@@ -322,7 +321,8 @@ void test_online_push__initialize(void)
* order to delete the remote branch pointed to by HEAD (usually master).
* See: https://raw.github.com/git/git/master/Documentation/RelNotes/1.7.0.txt
*/
cl_git_pass
(
git_remote_ls
(
_remote
,
delete_ref_cb
,
&
delete_specs
));
cl_git_pass
(
git_remote_ls
(
&
heads
,
&
heads_len
,
_remote
));
cl_git_pass
(
create_deletion_refspecs
(
&
delete_specs
,
heads
,
heads_len
));
if
(
delete_specs
.
length
)
{
git_push
*
push
;
...
...
tests-clar/online/push_util.c
View file @
ae297212
...
...
@@ -44,20 +44,23 @@ int record_update_tips_cb(const char *refname, const git_oid *a, const git_oid *
return
0
;
}
int
delete_ref_cb
(
git_remote_head
*
head
,
void
*
payload
)
int
create_deletion_refspecs
(
git_vector
*
out
,
const
git_remote_head
**
heads
,
size_t
heads_len
)
{
git_vector
*
delete_specs
=
(
git_vector
*
)
payload
;
git_buf
del_spec
=
GIT_BUF_INIT
;
size_t
i
;
/* Ignore malformed ref names (which also saves us from tag^{} */
if
(
!
git_reference_is_valid_name
(
head
->
name
))
return
0
;
/* Create a refspec that deletes a branch in the remote */
if
(
strcmp
(
head
->
name
,
"refs/heads/master"
))
{
cl_git_pass
(
git_buf_putc
(
&
del_spec
,
':'
));
cl_git_pass
(
git_buf_puts
(
&
del_spec
,
head
->
name
));
cl_git_pass
(
git_vector_insert
(
delete_specs
,
git_buf_detach
(
&
del_spec
)));
for
(
i
=
0
;
i
<
heads_len
;
i
++
)
{
const
git_remote_head
*
head
=
heads
[
i
];
/* Ignore malformed ref names (which also saves us from tag^{} */
if
(
!
git_reference_is_valid_name
(
head
->
name
))
return
0
;
/* Create a refspec that deletes a branch in the remote */
if
(
strcmp
(
head
->
name
,
"refs/heads/master"
))
{
cl_git_pass
(
git_buf_putc
(
&
del_spec
,
':'
));
cl_git_pass
(
git_buf_puts
(
&
del_spec
,
head
->
name
));
cl_git_pass
(
git_vector_insert
(
out
,
git_buf_detach
(
&
del_spec
)));
}
}
return
0
;
...
...
tests-clar/online/push_util.h
View file @
ae297212
...
...
@@ -41,12 +41,13 @@ void record_callbacks_data_clear(record_callbacks_data *data);
int
record_update_tips_cb
(
const
char
*
refname
,
const
git_oid
*
a
,
const
git_oid
*
b
,
void
*
data
);
/**
* C
allback for git_remote_list that adds refspecs to delete each ref
* C
reate a set of refspecs that deletes each of the inputs
*
* @param head a ref on the remote
* @param payload a git_push instance
* @param out the vector in which to store the refspecs
* @param heads the remote heads
* @param heads_len the size of the array
*/
int
delete_ref_cb
(
git_remote_head
*
head
,
void
*
payload
);
int
create_deletion_refspecs
(
git_vector
*
out
,
const
git_remote_head
**
heads
,
size_t
heads_len
);
/**
* Callback for git_remote_list that adds refspecs to vector
...
...
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