| 53 | } |
| 54 | |
| 55 | static void fetch_single_packfile(struct object_id *packfile_hash, |
| 56 | const char *url, |
| 57 | const char **index_pack_args) { |
| 58 | struct http_pack_request *preq; |
| 59 | struct slot_results results; |
| 60 | int ret; |
| 61 | |
| 62 | http_init(NULL, url, 0); |
| 63 | |
| 64 | preq = new_direct_http_pack_request(packfile_hash->hash, xstrdup(url)); |
| 65 | if (!preq) |
| 66 | die("couldn't create http pack request"); |
| 67 | preq->slot->results = &results; |
| 68 | preq->index_pack_args = index_pack_args; |
| 69 | preq->preserve_index_pack_stdout = 1; |
| 70 | |
| 71 | if (start_active_slot(preq->slot)) { |
| 72 | run_active_slot(preq->slot); |
| 73 | if (results.curl_result != CURLE_OK) { |
| 74 | struct url_info url; |
| 75 | char *nurl = url_normalize(preq->url, &url); |
| 76 | if (!nurl || !git_env_bool("GIT_TRACE_REDACT", 1)) { |
| 77 | die("unable to get pack file '%s'\n%s", preq->url, |
| 78 | curl_errorstr); |
| 79 | } else { |
| 80 | die("failed to get '%.*s' url from '%.*s' " |
| 81 | "(full URL redacted due to GIT_TRACE_REDACT setting)\n%s", |
| 82 | (int)url.scheme_len, url.url, |
| 83 | (int)url.host_len, &url.url[url.host_off], curl_errorstr); |
| 84 | } |
| 85 | } |
| 86 | } else { |
| 87 | die("Unable to start request"); |
| 88 | } |
| 89 | |
| 90 | if ((ret = finish_http_pack_request(preq))) |
| 91 | die("finish_http_pack_request gave result %d", ret); |
| 92 | |
| 93 | release_http_pack_request(preq); |
| 94 | http_cleanup(); |
| 95 | } |
| 96 | |
| 97 | int cmd_main(int argc, const char **argv) |
| 98 | { |
no test coverage detected