packed_read_raw_ref(): read the reference from the mmapped buffer
Instead of reading the reference from the `ref_cache`, read it directly from the mmapped buffer. Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:

committed by
Junio C Hamano

parent
d1cf15516f
commit
f3987ab36d
@ -876,18 +876,22 @@ static int packed_read_raw_ref(struct ref_store *ref_store,
|
|||||||
{
|
{
|
||||||
struct packed_ref_store *refs =
|
struct packed_ref_store *refs =
|
||||||
packed_downcast(ref_store, REF_STORE_READ, "read_raw_ref");
|
packed_downcast(ref_store, REF_STORE_READ, "read_raw_ref");
|
||||||
|
struct packed_ref_cache *packed_refs = get_packed_ref_cache(refs);
|
||||||
struct ref_entry *entry;
|
const char *rec;
|
||||||
|
|
||||||
*type = 0;
|
*type = 0;
|
||||||
|
|
||||||
entry = get_packed_ref(refs, refname);
|
rec = find_reference_location(packed_refs, refname, 1);
|
||||||
if (!entry) {
|
|
||||||
|
if (!rec) {
|
||||||
|
/* refname is not a packed reference. */
|
||||||
errno = ENOENT;
|
errno = ENOENT;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
hashcpy(sha1, entry->u.value.oid.hash);
|
if (get_sha1_hex(rec, sha1))
|
||||||
|
die_invalid_line(refs->path, rec, packed_refs->eof - rec);
|
||||||
|
|
||||||
*type = REF_ISPACKED;
|
*type = REF_ISPACKED;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user