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
f564017d
Commit
f564017d
authored
Apr 22, 2015
by
Carlos Martín Nieto
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #3065 from cthomas/master
Fix for Issue #3023 tests fail with no network
parents
aaf42c8d
fc6f044e
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
52 additions
and
51 deletions
+52
-51
tests/network/remote/remotes.c
+0
-51
tests/online/remotes.c
+52
-0
No files found.
tests/network/remote/remotes.c
View file @
f564017d
...
@@ -513,24 +513,6 @@ void test_network_remote_remotes__query_refspecs(void)
...
@@ -513,24 +513,6 @@ void test_network_remote_remotes__query_refspecs(void)
git_remote_free
(
remote
);
git_remote_free
(
remote
);
}
}
static
int
remote_single_branch
(
git_remote
**
out
,
git_repository
*
repo
,
const
char
*
name
,
const
char
*
url
,
void
*
payload
)
{
char
*
fetch_refspecs
[]
=
{
"refs/heads/first-merge:refs/remotes/origin/first-merge"
,
};
git_strarray
fetch_refspecs_strarray
=
{
fetch_refspecs
,
1
,
};
GIT_UNUSED
(
payload
);
cl_git_pass
(
git_remote_create
(
out
,
repo
,
name
,
url
));
cl_git_pass
(
git_remote_set_fetch_refspecs
(
*
out
,
&
fetch_refspecs_strarray
));
return
0
;
}
void
test_network_remote_remotes__fetch_from_anonymous
(
void
)
void
test_network_remote_remotes__fetch_from_anonymous
(
void
)
{
{
git_remote
*
remote
;
git_remote
*
remote
;
...
@@ -540,36 +522,3 @@ void test_network_remote_remotes__fetch_from_anonymous(void)
...
@@ -540,36 +522,3 @@ void test_network_remote_remotes__fetch_from_anonymous(void)
cl_git_pass
(
git_remote_fetch
(
remote
,
NULL
,
NULL
));
cl_git_pass
(
git_remote_fetch
(
remote
,
NULL
,
NULL
));
git_remote_free
(
remote
);
git_remote_free
(
remote
);
}
}
void
test_network_remote_remotes__single_branch
(
void
)
{
git_clone_options
opts
=
GIT_CLONE_OPTIONS_INIT
;
git_repository
*
repo
;
git_strarray
refs
;
size_t
i
,
count
=
0
;
opts
.
remote_cb
=
remote_single_branch
;
opts
.
checkout_branch
=
"first-merge"
;
cl_git_pass
(
git_clone
(
&
repo
,
"git://github.com/libgit2/TestGitRepository"
,
"./single-branch"
,
&
opts
));
cl_git_pass
(
git_reference_list
(
&
refs
,
repo
));
for
(
i
=
0
;
i
<
refs
.
count
;
i
++
)
{
if
(
!
git__prefixcmp
(
refs
.
strings
[
i
],
"refs/heads/"
))
count
++
;
}
cl_assert_equal_i
(
1
,
count
);
git_strarray_free
(
&
refs
);
git_repository_free
(
repo
);
}
void
test_network_remote_remotes__restricted_refspecs
(
void
)
{
git_clone_options
opts
=
GIT_CLONE_OPTIONS_INIT
;
git_repository
*
repo
;
opts
.
remote_cb
=
remote_single_branch
;
cl_git_fail_with
(
GIT_EINVALIDSPEC
,
git_clone
(
&
repo
,
"git://github.com/libgit2/TestGitRepository"
,
"./restrict-refspec"
,
&
opts
));
}
tests/online/remotes.c
0 → 100644
View file @
f564017d
#include "clar_libgit2.h"
static
int
remote_single_branch
(
git_remote
**
out
,
git_repository
*
repo
,
const
char
*
name
,
const
char
*
url
,
void
*
payload
)
{
char
*
fetch_refspecs
[]
=
{
"refs/heads/first-merge:refs/remotes/origin/first-merge"
,
};
git_strarray
fetch_refspecs_strarray
=
{
fetch_refspecs
,
1
,
};
GIT_UNUSED
(
payload
);
cl_git_pass
(
git_remote_create
(
out
,
repo
,
name
,
url
));
cl_git_pass
(
git_remote_set_fetch_refspecs
(
*
out
,
&
fetch_refspecs_strarray
));
return
0
;
}
void
test_online_remotes__single_branch
(
void
)
{
git_clone_options
opts
=
GIT_CLONE_OPTIONS_INIT
;
git_repository
*
repo
;
git_strarray
refs
;
size_t
i
,
count
=
0
;
opts
.
remote_cb
=
remote_single_branch
;
opts
.
checkout_branch
=
"first-merge"
;
cl_git_pass
(
git_clone
(
&
repo
,
"git://github.com/libgit2/TestGitRepository"
,
"./single-branch"
,
&
opts
));
cl_git_pass
(
git_reference_list
(
&
refs
,
repo
));
for
(
i
=
0
;
i
<
refs
.
count
;
i
++
)
{
if
(
!
git__prefixcmp
(
refs
.
strings
[
i
],
"refs/heads/"
))
count
++
;
}
cl_assert_equal_i
(
1
,
count
);
git_strarray_free
(
&
refs
);
git_repository_free
(
repo
);
}
void
test_online_remotes__restricted_refspecs
(
void
)
{
git_clone_options
opts
=
GIT_CLONE_OPTIONS_INIT
;
git_repository
*
repo
;
opts
.
remote_cb
=
remote_single_branch
;
cl_git_fail_with
(
GIT_EINVALIDSPEC
,
git_clone
(
&
repo
,
"git://github.com/libgit2/TestGitRepository"
,
"./restrict-refspec"
,
&
opts
));
}
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