diff options
| author | Carlos Martín Nieto <carlos@cmartin.tk> | 2011-08-12 22:44:35 +0200 |
|---|---|---|
| committer | Vicent Marti <tanoku@gmail.com> | 2011-08-18 02:34:10 +0200 |
| commit | 427ca3d3c5b415c3970759b9334425707497fdf4 (patch) | |
| tree | 67177cf55155a092d433ea0a148548bf22470d46 /src/fetch.c | |
| parent | 946dab73ba68b0d658cfb1544c1d35d1222b2087 (diff) | |
| download | libgit2-427ca3d3c5b415c3970759b9334425707497fdf4.tar.gz | |
Actually implement object negotiation
Only signal that we need a pack if we do need it and don't send a want
just because it's the first. If we don't need to download the pack,
then we can skip all of the negotiation and just return success.
Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
Diffstat (limited to 'src/fetch.c')
| -rw-r--r-- | src/fetch.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/fetch.c b/src/fetch.c index 03febe279..0dce875f8 100644 --- a/src/fetch.c +++ b/src/fetch.c @@ -75,6 +75,8 @@ static int filter_wants(git_remote *remote) /* If we have the object, mark it so we don't ask for it */ if (git_odb_exists(repo->db, &head->oid)) head->local = 1; + else + remote->need_pack = 1; error = git_vector_insert(&list, head); if (error < GIT_SUCCESS) @@ -108,11 +110,13 @@ int git_fetch_negotiate(git_remote *remote) /* Don't try to negotiate when we don't want anything */ if (list->len == 0) return GIT_SUCCESS; + if (!remote->need_pack) + return GIT_SUCCESS; + /* * Now we have everything set up so we can start tell the server * what we want and what we have. */ - remote->need_pack = 1; error = git_transport_send_wants(remote->transport, list); if (error < GIT_SUCCESS) return git__rethrow(error, "Failed to send want list"); |
