summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--fetch.c2
-rw-r--r--http-fetch.c10
-rw-r--r--local-fetch.c5
3 files changed, 14 insertions, 3 deletions
diff --git a/fetch.c b/fetch.c
index 3e073d3584..73bde07aea 100644
--- a/fetch.c
+++ b/fetch.c
@@ -165,7 +165,7 @@ static int loop(void)
* the queue because we needed to fetch it first.
*/
if (! (obj->flags & TO_SCAN)) {
- if (!has_sha1_file(obj->sha1) && fetch(obj->sha1)) {
+ if (fetch(obj->sha1)) {
report_missing(obj->type
? obj->type
: "object", obj->sha1);
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) {
diff --git a/local-fetch.c b/local-fetch.c
index a57386ca6a..87a93de02f 100644
--- a/local-fetch.c
+++ b/local-fetch.c
@@ -166,7 +166,10 @@ static int fetch_file(const unsigned char *sha1)
int fetch(unsigned char *sha1)
{
- return fetch_file(sha1) && fetch_pack(sha1);
+ if (has_sha1_file(sha1))
+ return 0;
+ else
+ return fetch_file(sha1) && fetch_pack(sha1);
}
int fetch_ref(char *ref, unsigned char *sha1)