Skip to content

Commit 0a95ac5

Browse files
mhaggergitster
authored andcommitted
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>
1 parent bd427cf commit 0a95ac5

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

refs/files-backend.c

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2384,14 +2384,14 @@ static int files_pack_refs(struct ref_store *ref_store, unsigned int flags)
23842384
*
23852385
* The refs in 'refnames' needn't be sorted. `err` must not be NULL.
23862386
*/
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)
23882389
{
2389-
struct files_ref_store *refs =
2390-
get_files_ref_store(NULL, "repack_without_refs");
23912390
struct ref_dir *packed;
23922391
struct string_list_item *refname;
23932392
int ret, needs_repacking = 0, removed = 0;
23942393

2394+
assert_main_repository(&refs->base, "repack_without_refs");
23952395
assert(err);
23962396

23972397
/* Look for a packed ref */
@@ -2453,13 +2453,15 @@ static int delete_ref_loose(struct ref_lock *lock, int flag, struct strbuf *err)
24532453

24542454
int delete_refs(struct string_list *refnames, unsigned int flags)
24552455
{
2456+
struct files_ref_store *refs =
2457+
get_files_ref_store(NULL, "delete_refs");
24562458
struct strbuf err = STRBUF_INIT;
24572459
int i, result = 0;
24582460

24592461
if (!refnames->nr)
24602462
return 0;
24612463

2462-
result = repack_without_refs(refnames, &err);
2464+
result = repack_without_refs(refs, refnames, &err);
24632465
if (result) {
24642466
/*
24652467
* If we failed to rewrite the packed-refs file, then
@@ -3769,7 +3771,7 @@ static int files_transaction_commit(struct ref_store *ref_store,
37693771
}
37703772
}
37713773

3772-
if (repack_without_refs(&refs_to_delete, err)) {
3774+
if (repack_without_refs(refs, &refs_to_delete, err)) {
37733775
ret = TRANSACTION_GENERIC_ERROR;
37743776
goto cleanup;
37753777
}

0 commit comments

Comments
 (0)