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
dc8adda4
Commit
dc8adda4
authored
Aug 15, 2014
by
Jacques Germishuys
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
git_remote_ls() should return an error if the transport is not available
parent
e1c44290
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
0 deletions
+18
-0
src/remote.c
+7
-0
tests/network/remote/local.c
+11
-0
No files found.
src/remote.c
View file @
dc8adda4
...
@@ -699,6 +699,11 @@ int git_remote_ls(const git_remote_head ***out, size_t *size, git_remote *remote
...
@@ -699,6 +699,11 @@ int git_remote_ls(const git_remote_head ***out, size_t *size, git_remote *remote
{
{
assert
(
remote
);
assert
(
remote
);
if
(
!
remote
->
transport
)
{
giterr_set
(
GITERR_NET
,
"No transport bound to this remote"
);
return
-
1
;
}
return
remote
->
transport
->
ls
(
out
,
size
,
remote
->
transport
);
return
remote
->
transport
->
ls
(
out
,
size
,
remote
->
transport
);
}
}
...
@@ -1942,6 +1947,8 @@ int git_remote_default_branch(git_buf *out, git_remote *remote)
...
@@ -1942,6 +1947,8 @@ int git_remote_default_branch(git_buf *out, git_remote *remote)
size_t
heads_len
,
i
;
size_t
heads_len
,
i
;
int
error
;
int
error
;
assert
(
out
);
if
((
error
=
git_remote_ls
(
&
heads
,
&
heads_len
,
remote
))
<
0
)
if
((
error
=
git_remote_ls
(
&
heads
,
&
heads_len
,
remote
))
<
0
)
return
error
;
return
error
;
...
...
tests/network/remote/local.c
View file @
dc8adda4
...
@@ -55,6 +55,17 @@ void test_network_remote_local__retrieve_advertised_references(void)
...
@@ -55,6 +55,17 @@ void test_network_remote_local__retrieve_advertised_references(void)
cl_assert_equal_i
(
refs_len
,
28
);
cl_assert_equal_i
(
refs_len
,
28
);
}
}
void
test_network_remote_local__retrieve_advertised_before_connect
(
void
)
{
const
git_remote_head
**
refs
;
size_t
refs_len
=
0
;
git_buf_sets
(
&
file_path_buf
,
cl_git_path_url
(
cl_fixture
(
"testrepo.git"
)));
cl_git_pass
(
git_remote_create_anonymous
(
&
remote
,
repo
,
git_buf_cstr
(
&
file_path_buf
),
NULL
));
cl_git_fail
(
git_remote_ls
(
&
refs
,
&
refs_len
,
remote
));
}
void
test_network_remote_local__retrieve_advertised_references_after_disconnect
(
void
)
void
test_network_remote_local__retrieve_advertised_references_after_disconnect
(
void
)
{
{
const
git_remote_head
**
refs
;
const
git_remote_head
**
refs
;
...
...
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