MCPcopy Index your code
hub / github.com/git/git / http_get_file

Function http_get_file

http.c:2500–2523  ·  view source on GitHub ↗

* Downloads a URL and stores the result in the given file. * * If a previous interrupted download is detected (i.e. a previous temporary * file is still around) the download is resumed. */

Source from the content-addressed store, hash-verified

2498 * file is still around) the download is resumed.
2499 */
2500int http_get_file(const char *url, const char *filename,
2501 struct http_get_options *options)
2502{
2503 int ret;
2504 struct strbuf tmpfile = STRBUF_INIT;
2505 FILE *result;
2506
2507 strbuf_addf(&tmpfile, "%s.temp", filename);
2508 result = fopen(tmpfile.buf, "a");
2509 if (!result) {
2510 error("Unable to open local file %s", tmpfile.buf);
2511 ret = HTTP_ERROR;
2512 goto cleanup;
2513 }
2514
2515 ret = http_request_recoverable(url, result, HTTP_REQUEST_FILE, options);
2516 fclose(result);
2517
2518 if (ret == HTTP_OK && finalize_object_file(the_repository, tmpfile.buf, filename))
2519 ret = HTTP_ERROR;
2520cleanup:
2521 strbuf_release(&tmpfile);
2522 return ret;
2523}
2524
2525int http_fetch_ref(const char *base, struct ref *ref)
2526{

Callers 2

fetch_pack_indexFunction · 0.85
parse_getFunction · 0.85

Calls 5

strbuf_addfFunction · 0.85
errorFunction · 0.85
http_request_recoverableFunction · 0.85
finalize_object_fileFunction · 0.85
strbuf_releaseFunction · 0.85

Tested by

no test coverage detected