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

Function http_fetch_ref

http.c:2525–2548  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2523}
2524
2525int http_fetch_ref(const char *base, struct ref *ref)
2526{
2527 struct http_get_options options = {0};
2528 char *url;
2529 struct strbuf buffer = STRBUF_INIT;
2530 int ret = -1;
2531
2532 options.no_cache = 1;
2533
2534 url = quote_ref_url(base, ref->name);
2535 if (http_get_strbuf(url, &buffer, &options) == HTTP_OK) {
2536 strbuf_rtrim(&buffer);
2537 if (buffer.len == the_hash_algo->hexsz)
2538 ret = get_oid_hex(buffer.buf, &ref->old_oid);
2539 else if (starts_with(buffer.buf, "ref: ")) {
2540 ref->symref = xstrdup(buffer.buf + 5);
2541 ret = 0;
2542 }
2543 }
2544
2545 strbuf_release(&buffer);
2546 free(url);
2547 return ret;
2548}
2549
2550/* Helpers for fetching packs */
2551static char *fetch_pack_index(unsigned char *hash, const char *base_url)

Callers 4

fetch_refFunction · 0.85
one_remote_refFunction · 0.85
add_remote_info_refFunction · 0.85
parse_info_refsFunction · 0.85

Calls 7

quote_ref_urlFunction · 0.85
http_get_strbufFunction · 0.85
strbuf_rtrimFunction · 0.85
get_oid_hexFunction · 0.85
starts_withFunction · 0.85
xstrdupFunction · 0.85
strbuf_releaseFunction · 0.85

Tested by

no test coverage detected