diff options
| author | Carlos Martín Nieto <carlos@cmartin.tk> | 2011-08-04 22:42:58 +0200 |
|---|---|---|
| committer | Vicent Marti <tanoku@gmail.com> | 2011-08-18 02:34:08 +0200 |
| commit | 48a65a071d9d6689a0ebb7891a20e8dab5fd3cdd (patch) | |
| tree | 872610c01b47d1b47029bf465e7efb4658f45306 /src/fetch.c | |
| parent | 9cf0f287bb0ece488c9e0a169b3f806a4a9701eb (diff) | |
| download | libgit2-48a65a071d9d6689a0ebb7891a20e8dab5fd3cdd.tar.gz | |
Only wait for pack if we need it
Provide the git_remote_download function to instruct the library to
downlad the packfile and let the user know the temporary location.
Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
Diffstat (limited to 'src/fetch.c')
| -rw-r--r-- | src/fetch.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/fetch.c b/src/fetch.c index 7e671b799..7abc196e4 100644 --- a/src/fetch.c +++ b/src/fetch.c @@ -45,7 +45,7 @@ static int whn_cmp(const void *a, const void *b) return headb->type - heada->type; } -int filter_wants(git_remote *remote) +static int filter_wants(git_remote *remote) { git_vector list; git_headarray refs; @@ -61,13 +61,13 @@ int filter_wants(git_remote *remote) error = git_transport_ls(t, &refs); if (error < GIT_SUCCESS) { - error = git__rethrow(error, "Failed to list local refs"); + error = git__rethrow(error, "Failed to get remote ref list"); goto cleanup; } spec = git_remote_fetchspec(remote); if (spec == NULL) { - error = git__throw(GIT_ERROR, "The remote has to fetchspec"); + error = git__throw(GIT_ERROR, "The remote has no fetchspec"); goto cleanup; } @@ -152,11 +152,11 @@ 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; - /* * Now we have everything set up so we can start tell the server * what we want and what we have. */ + remote->need_pack = 1; git_transport_send_wants(remote->transport, list); error = git_reference_listall(&refs, repo, GIT_REF_LISTALL); @@ -201,5 +201,10 @@ cleanup: int git_fetch_download_pack(char **out, git_remote *remote) { + if(!remote->need_pack) { + *out = NULL; + return GIT_SUCCESS; + } + return git_transport_download_pack(out, remote->transport, remote->repo); } |
