add_packed_ref(): add a files_ref_store argument

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Michael Haggerty committed Sep 4, 2016 at 18:08 UTC d99825ab73bbe2ae21e3056ffc1b594800a87cd7
1 file changed +5 -4
refs/files-backend.c
+5 -4
@@ -1192,10 +1192,9 @@ static struct ref_dir *get_packed_refs(struct files_ref_store *refs)
1192 * lock_packed_refs()). To actually write the packed-refs file, call
1193 * commit_packed_refs().
1194 */
1195 -static void add_packed_ref(const char *refname, const unsigned char *sha1)
1195 +static void add_packed_ref(struct files_ref_store *refs,
1196 + const char *refname, const unsigned char *sha1)
1197 {
1197 - struct files_ref_store *refs =
1198 - get_files_ref_store(NULL, "add_packed_ref");
1198 struct packed_ref_cache *packed_ref_cache = get_packed_ref_cache(refs);
1199
1200 if (!packed_ref_cache->lock)
@@ -3869,6 +3868,8 @@ static int ref_present(const char *refname,
3868 int initial_ref_transaction_commit(struct ref_transaction *transaction,
3869 struct strbuf *err)
3870 {
3871 + struct files_ref_store *refs =
3872 + get_files_ref_store(NULL, "initial_ref_transaction_commit");
3873 int ret = 0, i;
3874 struct string_list affected_refnames = STRING_LIST_INIT_NODUP;
3875
@@ -3928,7 +3929,7 @@ int initial_ref_transaction_commit(struct ref_transaction *transaction,
3929
3930 if ((update->flags & REF_HAVE_NEW) &&
3931 !is_null_sha1(update->new_sha1))
3931 - add_packed_ref(update->refname, update->new_sha1);
3932 + add_packed_ref(refs, update->refname, update->new_sha1);
3933 }
3934
3935 if (commit_packed_refs()) {