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

Function show_head_ref

http-backend.c:580–597  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

578}
579
580static int show_head_ref(const struct reference *ref, void *cb_data)
581{
582 struct strbuf *buf = cb_data;
583
584 if (ref->flags & REF_ISSYMREF) {
585 const char *target = refs_resolve_ref_unsafe(get_main_ref_store(the_repository),
586 ref->name,
587 RESOLVE_REF_READING,
588 NULL, NULL);
589
590 if (target)
591 strbuf_addf(buf, "ref: %s\n", strip_namespace(target));
592 } else {
593 strbuf_addf(buf, "%s\n", oid_to_hex(ref->oid));
594 }
595
596 return 0;
597}
598
599static void get_head(struct strbuf *hdr, char *arg UNUSED)
600{

Callers

nothing calls this directly

Calls 5

refs_resolve_ref_unsafeFunction · 0.85
get_main_ref_storeFunction · 0.85
strbuf_addfFunction · 0.85
strip_namespaceFunction · 0.85
oid_to_hexFunction · 0.85

Tested by

no test coverage detected