summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/fetch.c7
-rw-r--r--src/remote.c5
-rw-r--r--src/remote.h2
-rw-r--r--src/transport.c5
-rw-r--r--src/transport.h6
-rw-r--r--src/transport_git.c8
-rw-r--r--src/transport_local.c9
7 files changed, 40 insertions, 2 deletions
diff --git a/src/fetch.c b/src/fetch.c
index b9ddaf16c..59beb1ea3 100644
--- a/src/fetch.c
+++ b/src/fetch.c
@@ -44,7 +44,10 @@ static int whn_cmp(const void *a, const void *b)
return headb->type - heada->type;
}
-/* FIXME: we assume that the transport has been connected, enforce that somehow */
+/*
+ * FIXME: we assume that the transport has been connected, enforce
+ * that somehow, we also want to be called from _negotiate
+ */
int git_fetch_list_want(git_headarray *whn_list, git_repository *repo, git_remote *remote)
{
git_vector list;
@@ -179,7 +182,7 @@ int git_fetch_negotiate(git_headarray *list, git_repository *repo, git_remote *r
* Now we have everything set up so we can start tell the server
* what we want and what we have.
*/
- git_pkt_send_wants(list);
+ git_remote_send_wants(remote, list);
cleanup:
diff --git a/src/remote.c b/src/remote.c
index 2812f5de6..997da00ce 100644
--- a/src/remote.c
+++ b/src/remote.c
@@ -31,6 +31,11 @@
#include "repository.h"
#include "remote.h"
+int git_remote_send_wants(git_remote *remote, git_headarray *list)
+{
+ return git_transport_send_wants(remote->transport, list);
+}
+
static int refspec_parse(git_refspec *refspec, const char *str)
{
char *delim;
diff --git a/src/remote.h b/src/remote.h
index fdd6cd569..e0c3fbf8d 100644
--- a/src/remote.h
+++ b/src/remote.h
@@ -13,4 +13,6 @@ struct git_remote {
git_transport *transport;
};
+int git_remote_send_wants(git_remote *remote, git_headarray *list);
+
#endif
diff --git a/src/transport.c b/src/transport.c
index 204ef176f..96b79ddf4 100644
--- a/src/transport.c
+++ b/src/transport.c
@@ -80,6 +80,11 @@ int git_transport_ls(git_transport *transport, git_headarray *array)
return transport->ls(transport, array);
}
+int git_transport_send_wants(struct git_transport *transport, git_headarray *array)
+{
+ return transport->send_wants(transport, array);
+}
+
int git_transport_close(git_transport *transport)
{
return transport->close(transport);
diff --git a/src/transport.h b/src/transport.h
index b17d9a929..9105ea453 100644
--- a/src/transport.h
+++ b/src/transport.h
@@ -57,6 +57,10 @@ struct git_transport {
*/
int (*push)(struct git_transport *transport);
/**
+ * Send the list of 'want' refs
+ */
+ int (*send_wants)(struct git_transport *transport, git_headarray *list);
+ /**
* Fetch the changes
*/
int (*fetch)(struct git_transport *transport);
@@ -74,4 +78,6 @@ int git_transport_local(struct git_transport **transport);
int git_transport_git(struct git_transport **transport);
int git_transport_dummy(struct git_transport **transport);
+int git_transport_send_wants(struct git_transport *transport, git_headarray *array);
+
#endif
diff --git a/src/transport_git.c b/src/transport_git.c
index b07b98660..41b95ec2a 100644
--- a/src/transport_git.c
+++ b/src/transport_git.c
@@ -274,6 +274,13 @@ static int git_ls(git_transport *transport, git_headarray *array)
return GIT_SUCCESS;
}
+static int git_send_wants(git_transport *transport, git_headarray *array)
+{
+ transport_git *t = (transport_git *) transport;
+
+ return git_pkt_send_wants(array, t->socket);
+}
+
static int git_close(git_transport *transport)
{
transport_git *t = (transport_git*) transport;
@@ -318,6 +325,7 @@ int git_transport_git(git_transport **out)
t->parent.connect = git_connect;
t->parent.ls = git_ls;
+ t->parent.send_wants = git_send_wants;
t->parent.close = git_close;
t->parent.free = git_free;
diff --git a/src/transport_local.c b/src/transport_local.c
index 4e0ac6f31..b38679a3b 100644
--- a/src/transport_local.c
+++ b/src/transport_local.c
@@ -165,6 +165,15 @@ static int local_ls(git_transport *transport, git_headarray *array)
return error;
}
+static int local_send_wants(git_transport *GIT_UNUSED(transport), git_headarray *GIT_UNUSED(array))
+{
+ GIT_UNUSED_ARG(tranport);
+ GIT_UNUSED_ARG(array);
+
+ /* We're local anyway, so we don't need this */
+ return GIT_SUCCESS;
+}
+
static int local_close(git_transport *GIT_UNUSED(transport))
{
/* Nothing to do */