Skip to content

Commit 0f199b1

Browse files
mhaggergitster
authored andcommitted
repack_without_refs(): 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>
1 parent f3f9724 commit 0f199b1

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

refs/files-backend.c

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1621,19 +1621,19 @@ static int files_pack_refs(struct ref_store *ref_store, unsigned int flags)
16211621
*
16221622
* The refs in 'refnames' needn't be sorted. `err` must not be NULL.
16231623
*/
1624-
static int repack_without_refs(struct files_ref_store *refs,
1624+
static int repack_without_refs(struct packed_ref_store *refs,
16251625
struct string_list *refnames, struct strbuf *err)
16261626
{
16271627
struct ref_dir *packed;
16281628
struct string_list_item *refname;
16291629
int ret, needs_repacking = 0, removed = 0;
16301630

1631-
files_assert_main_repository(refs, "repack_without_refs");
1631+
packed_assert_main_repository(refs, "repack_without_refs");
16321632
assert(err);
16331633

16341634
/* Look for a packed ref */
16351635
for_each_string_list_item(refname, refnames) {
1636-
if (get_packed_ref(refs->packed_ref_store, refname->string)) {
1636+
if (get_packed_ref(refs, refname->string)) {
16371637
needs_repacking = 1;
16381638
break;
16391639
}
@@ -1643,11 +1643,11 @@ static int repack_without_refs(struct files_ref_store *refs,
16431643
if (!needs_repacking)
16441644
return 0; /* no refname exists in packed refs */
16451645

1646-
if (lock_packed_refs(refs->packed_ref_store, 0)) {
1647-
unable_to_lock_message(refs->packed_ref_store->path, errno, err);
1646+
if (lock_packed_refs(refs, 0)) {
1647+
unable_to_lock_message(refs->path, errno, err);
16481648
return -1;
16491649
}
1650-
packed = get_packed_refs(refs->packed_ref_store);
1650+
packed = get_packed_refs(refs);
16511651

16521652
/* Remove refnames from the cache */
16531653
for_each_string_list_item(refname, refnames)
@@ -1658,12 +1658,12 @@ static int repack_without_refs(struct files_ref_store *refs,
16581658
* All packed entries disappeared while we were
16591659
* acquiring the lock.
16601660
*/
1661-
rollback_packed_refs(refs->packed_ref_store);
1661+
rollback_packed_refs(refs);
16621662
return 0;
16631663
}
16641664

16651665
/* Write what remains */
1666-
ret = commit_packed_refs(refs->packed_ref_store);
1666+
ret = commit_packed_refs(refs);
16671667
if (ret)
16681668
strbuf_addf(err, "unable to overwrite old ref-pack file: %s",
16691669
strerror(errno));
@@ -1681,7 +1681,7 @@ static int files_delete_refs(struct ref_store *ref_store, const char *msg,
16811681
if (!refnames->nr)
16821682
return 0;
16831683

1684-
result = repack_without_refs(refs, refnames, &err);
1684+
result = repack_without_refs(refs->packed_ref_store, refnames, &err);
16851685
if (result) {
16861686
/*
16871687
* If we failed to rewrite the packed-refs file, then
@@ -3101,7 +3101,7 @@ static int files_transaction_finish(struct ref_store *ref_store,
31013101
}
31023102
}
31033103

3104-
if (repack_without_refs(refs, &refs_to_delete, err)) {
3104+
if (repack_without_refs(refs->packed_ref_store, &refs_to_delete, err)) {
31053105
ret = TRANSACTION_GENERIC_ERROR;
31063106
goto cleanup;
31073107
}

0 commit comments

Comments
 (0)