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
edbaa63a
Commit
edbaa63a
authored
Jun 25, 2013
by
Arthur Schreiber
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Unbreak git_remote_ls on a local transport after disconnecting.
parent
eddc1f1e
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
12 deletions
+27
-12
src/transports/local.c
+15
-12
tests-clar/network/remote/local.c
+12
-0
No files found.
src/transports/local.c
View file @
edbaa63a
...
...
@@ -119,15 +119,24 @@ on_error:
static
int
store_refs
(
transport_local
*
t
)
{
unsigned
int
i
;
size_t
i
;
git_remote_head
*
head
;
git_strarray
ref_names
=
{
0
};
assert
(
t
);
if
(
git_reference_list
(
&
ref_names
,
t
->
repo
)
<
0
||
git_vector_init
(
&
t
->
refs
,
ref_names
.
count
,
NULL
)
<
0
)
if
(
git_reference_list
(
&
ref_names
,
t
->
repo
)
<
0
)
goto
on_error
;
/* Clear all heads we might have fetched in a previous connect */
git_vector_foreach
(
&
t
->
refs
,
i
,
head
)
{
git__free
(
head
->
name
);
git__free
(
head
);
}
/* Clear the vector so we can reuse it */
git_vector_clear
(
&
t
->
refs
);
/* Sort the references first */
git__tsort
((
void
**
)
ref_names
.
strings
,
ref_names
.
count
,
&
git__strcmp_cb
);
...
...
@@ -571,8 +580,6 @@ static void local_cancel(git_transport *transport)
static
int
local_close
(
git_transport
*
transport
)
{
transport_local
*
t
=
(
transport_local
*
)
transport
;
size_t
i
;
git_remote_head
*
head
;
t
->
connected
=
0
;
...
...
@@ -586,13 +593,6 @@ static int local_close(git_transport *transport)
t
->
url
=
NULL
;
}
git_vector_foreach
(
&
t
->
refs
,
i
,
head
)
{
git__free
(
head
->
name
);
git__free
(
head
);
}
git_vector_free
(
&
t
->
refs
);
return
0
;
}
...
...
@@ -600,6 +600,8 @@ static void local_free(git_transport *transport)
{
transport_local
*
t
=
(
transport_local
*
)
transport
;
git_vector_free
(
&
t
->
refs
);
/* Close the transport, if it's still open. */
local_close
(
transport
);
...
...
@@ -632,6 +634,7 @@ int git_transport_local(git_transport **out, git_remote *owner, void *param)
t
->
parent
.
read_flags
=
local_read_flags
;
t
->
parent
.
cancel
=
local_cancel
;
git_vector_init
(
&
t
->
refs
,
0
,
NULL
);
t
->
owner
=
owner
;
*
out
=
(
git_transport
*
)
t
;
...
...
tests-clar/network/remote/local.c
View file @
edbaa63a
...
...
@@ -75,6 +75,18 @@ void test_network_remote_local__retrieve_advertised_references(void)
cl_assert_equal_i
(
how_many_refs
,
28
);
}
void
test_network_remote_local__retrieve_advertised_references_after_disconnect
(
void
)
{
int
how_many_refs
=
0
;
connect_to_local_repository
(
cl_fixture
(
"testrepo.git"
));
git_remote_disconnect
(
remote
);
cl_git_pass
(
git_remote_ls
(
remote
,
&
count_ref__cb
,
&
how_many_refs
));
cl_assert_equal_i
(
how_many_refs
,
28
);
}
void
test_network_remote_local__retrieve_advertised_references_from_spaced_repository
(
void
)
{
int
how_many_refs
=
0
;
...
...
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