summaryrefslogtreecommitdiff
path: root/http-fetch.c
diff options
context:
space:
mode:
authorNick Hengeveld <nickh@reactrix.com>2005-10-10 23:22:01 -0700
committerJunio C Hamano <junkio@cox.net>2005-10-10 23:22:01 -0700
commit11f0dafe2be419240c0006c3e9112cbad3568baf (patch)
tree57108f4d25274418051dc75df946120a270c4d0a /http-fetch.c
parent380792390e05e744f9d7eefbc35d1db80e44e27a (diff)
downloadgit-11f0dafe2be419240c0006c3e9112cbad3568baf.tar.gz
[PATCH] Don't fetch objects that exist in the local repository
Be sure not to fetch objects that already exist in the local repository. The main process loop no longer performs this check, http-fetch now checks prior to starting a new request queue entry and when fetch_object() is called, and local-fetch now checks when fetch_object() is called. As discussed in this thread: http://marc.theaimsgroup.com/?t=112854890500001 Signed-off-by: Nick Hengeveld <nickh@reactrix.com>
Diffstat (limited to 'http-fetch.c')
-rw-r--r--http-fetch.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/http-fetch.c b/http-fetch.c
index dd9ea4ca17..d1e4593ba7 100644
--- a/http-fetch.c
+++ b/http-fetch.c
@@ -489,7 +489,10 @@ void process_request_queue()
while (active_requests < max_requests && request != NULL) {
if (request->state == WAITING) {
- start_request(request);
+ if (has_sha1_file(request->sha1))
+ release_request(request);
+ else
+ start_request(request);
curl_multi_perform(curlm, &num_transfers);
}
request = request->next;
@@ -890,6 +893,11 @@ static int fetch_object(struct alt_base *repo, unsigned char *sha1)
if (request == NULL)
return error("Couldn't find request for %s in the queue", hex);
+ if (has_sha1_file(request->sha1)) {
+ release_request(request);
+ return 0;
+ }
+
#ifdef USE_CURL_MULTI
int num_transfers;
while (request->state == WAITING) {