projects
/
git.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
builtin-diff: \No newline at end of file.
[git.git]
/
http-fetch.c
diff --git
a/http-fetch.c
b/http-fetch.c
index
ce3df5f
..
dc67218
100644
(file)
--- a/
http-fetch.c
+++ b/
http-fetch.c
@@
-8,6
+8,7
@@
#define RANGE_HEADER_SIZE 30
static int got_alternates = -1;
#define RANGE_HEADER_SIZE 30
static int got_alternates = -1;
+static int corrupt_object_found = 0;
static struct curl_slist *no_pragma_header;
static struct curl_slist *no_pragma_header;
@@
-130,7
+131,7
@@
static void start_object_request(struct object_request *obj_req)
if (obj_req->local < 0) {
obj_req->state = ABORTED;
if (obj_req->local < 0) {
obj_req->state = ABORTED;
- error("Couldn't create temporary file %s for %s: %s
\n
",
+ error("Couldn't create temporary file %s for %s: %s",
obj_req->tmpfile, obj_req->filename, strerror(errno));
return;
}
obj_req->tmpfile, obj_req->filename, strerror(errno));
return;
}
@@
-468,9
+469,13
@@
static void process_alternates_response(void *callback_data)
alt_req->url);
active_requests++;
slot->in_use = 1;
alt_req->url);
active_requests++;
slot->in_use = 1;
+ if (slot->finished != NULL)
+ (*slot->finished) = 0;
if (!start_active_slot(slot)) {
got_alternates = -1;
slot->in_use = 0;
if (!start_active_slot(slot)) {
got_alternates = -1;
slot->in_use = 0;
+ if (slot->finished != NULL)
+ (*slot->finished) = 1;
}
return;
}
}
return;
}
@@
-830,9
+835,10
@@
static int fetch_object(struct alt_base *repo, unsigned char *sha1)
obj_req->errorstr, obj_req->curl_result,
obj_req->http_code, hex);
} else if (obj_req->zret != Z_STREAM_END) {
obj_req->errorstr, obj_req->curl_result,
obj_req->http_code, hex);
} else if (obj_req->zret != Z_STREAM_END) {
- ret = error("File %s (%s) corrupt\n", hex, obj_req->url);
+ corrupt_object_found++;
+ ret = error("File %s (%s) corrupt", hex, obj_req->url);
} else if (memcmp(obj_req->sha1, obj_req->real_sha1, 20)) {
} else if (memcmp(obj_req->sha1, obj_req->real_sha1, 20)) {
- ret = error("File %s has bad hash
\n
", hex);
+ ret = error("File %s has bad hash", hex);
} else if (obj_req->rename < 0) {
ret = error("unable to write sha1 filename %s",
obj_req->filename);
} else if (obj_req->rename < 0) {
ret = error("unable to write sha1 filename %s",
obj_req->filename);
@@
-854,7
+860,7
@@
int fetch(unsigned char *sha1)
fetch_alternates(alt->base);
altbase = altbase->next;
}
fetch_alternates(alt->base);
altbase = altbase->next;
}
- return error("Unable to find %s under %s
\n
", sha1_to_hex(sha1),
+ return error("Unable to find %s under %s", sha1_to_hex(sha1),
alt->base);
}
alt->base);
}
@@
-989,5
+995,11
@@
int main(int argc, char **argv)
http_cleanup();
http_cleanup();
+ if (corrupt_object_found) {
+ fprintf(stderr,
+"Some loose object were found to be corrupt, but they might be just\n"
+"a false '404 Not Found' error message sent with incorrect HTTP\n"
+"status code. Suggest running git fsck-objects.\n");
+ }
return rc;
}
return rc;
}