add_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>

Michael Haggerty committed Jun 23, 2017 at 09:01 UTC e70b70294e7010c6281766b5229fb811df193870
1 file changed +5 -5
refs/files-backend.c
+5 -5
@@ -438,19 +438,19 @@ static struct ref_dir *get_packed_refs(struct packed_ref_store *refs)
438 * (see lock_packed_refs()). To actually write the packed-refs file,
439 * call commit_packed_refs().
440 */
441 -static void add_packed_ref(struct files_ref_store *refs,
441 +static void add_packed_ref(struct packed_ref_store *refs,
442 const char *refname, const struct object_id *oid)
443 {
444 struct ref_dir *packed_refs;
445 struct ref_entry *packed_entry;
446
447 - if (!is_lock_file_locked(&refs->packed_ref_store->lock))
447 + if (!is_lock_file_locked(&refs->lock))
448 die("BUG: packed refs not locked");
449
450 if (check_refname_format(refname, REFNAME_ALLOW_ONELEVEL))
451 die("Reference has invalid format: '%s'", refname);
452
453 - packed_refs = get_packed_refs(refs->packed_ref_store);
453 + packed_refs = get_packed_refs(refs);
454 packed_entry = find_ref_entry(packed_refs, refname);
455 if (packed_entry) {
456 /* Overwrite the existing entry: */
@@ -1579,7 +1579,7 @@ static int files_pack_refs(struct ref_store *ref_store, unsigned int flags)
1579 * we don't copy the peeled status, because we want it
1580 * to be re-peeled.
1581 */
1582 - add_packed_ref(refs, iter->refname, iter->oid);
1582 + add_packed_ref(refs->packed_ref_store, iter->refname, iter->oid);
1583
1584 /* Schedule the loose reference for pruning if requested. */
1585 if ((flags & PACK_REFS_PRUNE)) {
@@ -3210,7 +3210,7 @@ static int files_initial_transaction_commit(struct ref_store *ref_store,
3210
3211 if ((update->flags & REF_HAVE_NEW) &&
3212 !is_null_oid(&update->new_oid))
3213 - add_packed_ref(refs, update->refname,
3213 + add_packed_ref(refs->packed_ref_store, update->refname,
3214 &update->new_oid);
3215 }
3216