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

Function refs_read_special_head

refs.c:2062–2084  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2060}
2061
2062static int refs_read_special_head(struct ref_store *ref_store,
2063 const char *refname, struct object_id *oid,
2064 struct strbuf *referent, unsigned int *type,
2065 int *failure_errno)
2066{
2067 struct strbuf full_path = STRBUF_INIT;
2068 struct strbuf content = STRBUF_INIT;
2069 int result = -1;
2070 strbuf_addf(&full_path, "%s/%s", ref_store->gitdir, refname);
2071
2072 if (strbuf_read_file(&content, full_path.buf, 0) < 0) {
2073 *failure_errno = errno;
2074 goto done;
2075 }
2076
2077 result = parse_loose_ref_contents(ref_store->repo->hash_algo, content.buf,
2078 oid, referent, type, NULL, failure_errno);
2079
2080done:
2081 strbuf_release(&full_path);
2082 strbuf_release(&content);
2083 return result;
2084}
2085
2086int refs_read_raw_ref(struct ref_store *ref_store, const char *refname,
2087 struct object_id *oid, struct strbuf *referent,

Callers 1

refs_read_raw_refFunction · 0.85

Calls 4

strbuf_addfFunction · 0.85
strbuf_read_fileFunction · 0.85
parse_loose_ref_contentsFunction · 0.85
strbuf_releaseFunction · 0.85

Tested by

no test coverage detected