MCPcopy Create free account
hub / github.com/git/git / refs_from_alternate_cb

Function refs_from_alternate_cb

odb.c:437–461  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

435};
436
437static int refs_from_alternate_cb(struct odb_source *alternate,
438 void *payload)
439{
440 struct strbuf path = STRBUF_INIT;
441 size_t base_len;
442 struct alternate_refs_data *cb = payload;
443
444 if (!strbuf_realpath(&path, alternate->path, 0))
445 goto out;
446 if (!strbuf_strip_suffix(&path, "/objects"))
447 goto out;
448 base_len = path.len;
449
450 /* Is this a git repository with refs? */
451 strbuf_addstr(&path, "/refs");
452 if (!is_directory(path.buf))
453 goto out;
454 strbuf_setlen(&path, base_len);
455
456 read_alternate_refs(alternate->odb->repo, path.buf, cb->fn, cb->payload);
457
458out:
459 strbuf_release(&path);
460 return 0;
461}
462
463void odb_for_each_alternate_ref(struct object_database *odb,
464 odb_for_each_alternate_ref_fn cb, void *payload)

Callers

nothing calls this directly

Calls 7

strbuf_realpathFunction · 0.85
strbuf_strip_suffixFunction · 0.85
strbuf_addstrFunction · 0.85
is_directoryFunction · 0.85
strbuf_setlenFunction · 0.85
read_alternate_refsFunction · 0.85
strbuf_releaseFunction · 0.85

Tested by

no test coverage detected