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

Function packed_read_raw_ref

refs/packed-backend.c:816–840  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

814}
815
816static int packed_read_raw_ref(struct ref_store *ref_store, const char *refname,
817 struct object_id *oid, struct strbuf *referent UNUSED,
818 unsigned int *type, int *failure_errno)
819{
820 struct packed_ref_store *refs =
821 packed_downcast(ref_store, REF_STORE_READ, "read_raw_ref");
822 struct snapshot *snapshot = get_snapshot(refs);
823 const char *rec;
824
825 *type = 0;
826
827 rec = find_reference_location(snapshot, refname, 1);
828
829 if (!rec) {
830 /* refname is not a packed reference. */
831 *failure_errno = ENOENT;
832 return -1;
833 }
834
835 if (get_oid_hex_algop(rec, oid, ref_store->repo->hash_algo))
836 die_invalid_line(refs->path, rec, snapshot->eof - rec);
837
838 *type = REF_ISPACKED;
839 return 0;
840}
841
842/*
843 * This value is set in `base.flags` if the peeled value of the

Callers

nothing calls this directly

Calls 5

packed_downcastFunction · 0.85
get_snapshotFunction · 0.85
find_reference_locationFunction · 0.85
get_oid_hex_algopFunction · 0.85
die_invalid_lineFunction · 0.85

Tested by

no test coverage detected