get_packed_ref(): take a packed_ref_store * parameter

It only cares about the packed-refs part of the reference store.

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Michael Haggerty
2017-06-23 09:01:32 +02:00
committed by Junio C Hamano
parent 38e3fe6dec
commit f3f9724940

View File

@ -602,10 +602,10 @@ static struct ref_cache *get_loose_ref_cache(struct files_ref_store *refs)
* Return the ref_entry for the given refname from the packed * Return the ref_entry for the given refname from the packed
* references. If it does not exist, return NULL. * references. If it does not exist, return NULL.
*/ */
static struct ref_entry *get_packed_ref(struct files_ref_store *refs, static struct ref_entry *get_packed_ref(struct packed_ref_store *refs,
const char *refname) const char *refname)
{ {
return find_ref_entry(get_packed_refs(refs->packed_ref_store), refname); return find_ref_entry(get_packed_refs(refs), refname);
} }
/* /*
@ -621,7 +621,7 @@ static int resolve_packed_ref(struct files_ref_store *refs,
* The loose reference file does not exist; check for a packed * The loose reference file does not exist; check for a packed
* reference. * reference.
*/ */
entry = get_packed_ref(refs, refname); entry = get_packed_ref(refs->packed_ref_store, refname);
if (entry) { if (entry) {
hashcpy(sha1, entry->u.value.oid.hash); hashcpy(sha1, entry->u.value.oid.hash);
*flags |= REF_ISPACKED; *flags |= REF_ISPACKED;
@ -1044,7 +1044,9 @@ static int files_peel_ref(struct ref_store *ref_store,
* have REF_KNOWS_PEELED. * have REF_KNOWS_PEELED.
*/ */
if (flag & REF_ISPACKED) { if (flag & REF_ISPACKED) {
struct ref_entry *r = get_packed_ref(refs, refname); struct ref_entry *r =
get_packed_ref(refs->packed_ref_store, refname);
if (r) { if (r) {
if (peel_entry(r, 0)) if (peel_entry(r, 0))
return -1; return -1;
@ -1631,7 +1633,7 @@ static int repack_without_refs(struct files_ref_store *refs,
/* Look for a packed ref */ /* Look for a packed ref */
for_each_string_list_item(refname, refnames) { for_each_string_list_item(refname, refnames) {
if (get_packed_ref(refs, refname->string)) { if (get_packed_ref(refs->packed_ref_store, refname->string)) {
needs_repacking = 1; needs_repacking = 1;
break; break;
} }