summaryrefslogtreecommitdiff
path: root/src/fetch.c
diff options
context:
space:
mode:
authorCarlos Martín Nieto <carlos@cmartin.tk>2011-07-31 02:40:43 +0200
committerVicent Marti <tanoku@gmail.com>2011-08-18 02:34:07 +0200
commitda2902204b12e4ba2ad218590f0826a8b8c1badc (patch)
tree575c1497d251f9f762d5007f5279ecbfa31c42bb /src/fetch.c
parent7e1a94db11f38c87ae224821a8c570ffa1e11270 (diff)
downloadlibgit2-da2902204b12e4ba2ad218590f0826a8b8c1badc.tar.gz
Download pack
Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
Diffstat (limited to 'src/fetch.c')
-rw-r--r--src/fetch.c32
1 files changed, 8 insertions, 24 deletions
diff --git a/src/fetch.c b/src/fetch.c
index 61bcc1542..522625ef0 100644
--- a/src/fetch.c
+++ b/src/fetch.c
@@ -131,22 +131,6 @@ cleanup:
return error;
}
-/* Push any (OID) ref it gets into the walker */
-static int push_stuff(const char *name, void *data)
-{
- git_revwalk *walk = (git_revwalk *) data;
- git_reference *ref;
- git_repository *repo;
- int error;
-
- repo = git_revwalk_repository(walk);
- error = git_reference_lookup(&ref, repo, name);
- if (error < GIT_SUCCESS)
- return error;
-
- return git_revwalk_push(walk, git_reference_oid(ref));
-}
-
/*
* In this first version, we push all our refs in and start sending
* them out. When we get an ACK we hide that commit and continue
@@ -157,12 +141,14 @@ int git_fetch_negotiate(git_headarray *list, git_repository *repo, git_remote *r
git_revwalk *walk;
int error;
unsigned int i;
- char local[1024];
- git_refspec *spec;
git_reference *ref;
git_strarray refs;
git_oid oid;
+ /* Don't try to negotiate when we don't want anything */
+ if (list->len == 0)
+ return GIT_EINVALIDARGS;
+
/*
* Now we have everything set up so we can start tell the server
* what we want and what we have.
@@ -201,17 +187,15 @@ int git_fetch_negotiate(git_headarray *list, git_repository *repo, git_remote *r
error = GIT_SUCCESS;
/* TODO: git_pkt_send_flush(fd), or git_transport_flush() */
- printf("Wound send 0000\n");
+ git_transport_send_flush(remote->transport);
+ git_transport_send_done(remote->transport);
cleanup:
git_revwalk_free(walk);
return error;
}
-int git_fetch_download_pack(git_remote *remote)
+int git_fetch_download_pack(git_remote *remote, git_repository *repo)
{
- /*
- * First, we ignore any ACKs we receive and wait for a NACK
- */
- return GIT_ENOTIMPLEMENTED;
+ return git_transport_download_pack(remote->transport, repo);
}