Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/libgit2.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarlos Martín Nieto <cmn@dwim.me>2013-11-02 03:05:32 +0400
committerCarlos Martín Nieto <cmn@dwim.me>2013-11-11 18:35:51 +0400
commit359dce726d215be65aee719c7316b43e3851c031 (patch)
tree7a4a0c0af01d2d02683a3aed27eca8315f1f9ca0 /src/transports/local.c
parent266af6d81960144334c16e061f1d30f94f8a1b46 (diff)
remote: make _ls return the list directly
The callback-based method of listing remote references dates back to the beginning of the network code's lifetime, when we didn't know any better. We need to keep the list around for update_tips() after disconnect() so let's make use of this to simply give the user a pointer to the array so they can write straightforward code instead of having to go through a callback.
Diffstat (limited to 'src/transports/local.c')
-rw-r--r--src/transports/local.c10
1 files changed, 3 insertions, 7 deletions
diff --git a/src/transports/local.c b/src/transports/local.c
index 3163d2eac..4502f0202 100644
--- a/src/transports/local.c
+++ b/src/transports/local.c
@@ -213,21 +213,17 @@ static int local_connect(
return 0;
}
-static int local_ls(git_transport *transport, git_headlist_cb list_cb, void *payload)
+static int local_ls(const git_remote_head ***out, size_t *size, git_transport *transport)
{
transport_local *t = (transport_local *)transport;
- unsigned int i;
- git_remote_head *head = NULL;
if (!t->have_refs) {
giterr_set(GITERR_NET, "The transport has not yet loaded the refs");
return -1;
}
- git_vector_foreach(&t->refs, i, head) {
- if (list_cb(head, payload))
- return GIT_EUSER;
- }
+ *out = (const git_remote_head **) t->refs.contents;
+ *size = t->refs.length;
return 0;
}