Commit 0e20ba60 by Carlos Martín Nieto Committed by Vicent Marti

Add a generic send_wants

Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
parent 65fbc48a
......@@ -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:
......
......@@ -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;
......
......@@ -13,4 +13,6 @@ struct git_remote {
git_transport *transport;
};
int git_remote_send_wants(git_remote *remote, git_headarray *list);
#endif
......@@ -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);
......
......@@ -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
......@@ -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;
......
......@@ -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 */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment