repack_without_refs(): 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 0a95ac5f630c01ba8a50b72cae9e067cb256cb0f
1 file changed +7 -5
refs/files-backend.c
+7 -5
@@ -2384,14 +2384,14 @@ static int files_pack_refs(struct ref_store *ref_store, unsigned int flags)
2384 *
2385 * The refs in 'refnames' needn't be sorted. `err` must not be NULL.
2386 */
2387 -static int repack_without_refs(struct string_list *refnames, struct strbuf *err)
2387 +static int repack_without_refs(struct files_ref_store *refs,
2388 + struct string_list *refnames, struct strbuf *err)
2389 {
2389 - struct files_ref_store *refs =
2390 - get_files_ref_store(NULL, "repack_without_refs");
2390 struct ref_dir *packed;
2391 struct string_list_item *refname;
2392 int ret, needs_repacking = 0, removed = 0;
2393
2394 + assert_main_repository(&refs->base, "repack_without_refs");
2395 assert(err);
2396
2397 /* Look for a packed ref */
@@ -2453,13 +2453,15 @@ static int delete_ref_loose(struct ref_lock *lock, int flag, struct strbuf *err)
2453
2454 int delete_refs(struct string_list *refnames, unsigned int flags)
2455 {
2456 + struct files_ref_store *refs =
2457 + get_files_ref_store(NULL, "delete_refs");
2458 struct strbuf err = STRBUF_INIT;
2459 int i, result = 0;
2460
2461 if (!refnames->nr)
2462 return 0;
2463
2462 - result = repack_without_refs(refnames, &err);
2464 + result = repack_without_refs(refs, refnames, &err);
2465 if (result) {
2466 /*
2467 * If we failed to rewrite the packed-refs file, then
@@ -3769,7 +3771,7 @@ static int files_transaction_commit(struct ref_store *ref_store,
3771 }
3772 }
3773
3772 - if (repack_without_refs(&refs_to_delete, err)) {
3774 + if (repack_without_refs(refs, &refs_to_delete, err)) {
3775 ret = TRANSACTION_GENERIC_ERROR;
3776 goto cleanup;
3777 }