*
* The refs in 'refnames' needn't be sorted. `err` must not be NULL.
*/
-static int repack_without_refs(struct files_ref_store *refs,
+static int repack_without_refs(struct packed_ref_store *refs,
struct string_list *refnames, struct strbuf *err)
{
struct ref_dir *packed;
struct string_list_item *refname;
int ret, needs_repacking = 0, removed = 0;
- files_assert_main_repository(refs, "repack_without_refs");
+ packed_assert_main_repository(refs, "repack_without_refs");
assert(err);
/* Look for a packed ref */
for_each_string_list_item(refname, refnames) {
- if (get_packed_ref(refs->packed_ref_store, refname->string)) {
+ if (get_packed_ref(refs, refname->string)) {
needs_repacking = 1;
break;
}
if (!needs_repacking)
return 0; /* no refname exists in packed refs */
- if (lock_packed_refs(refs->packed_ref_store, 0)) {
- unable_to_lock_message(refs->packed_ref_store->path, errno, err);
+ if (lock_packed_refs(refs, 0)) {
+ unable_to_lock_message(refs->path, errno, err);
return -1;
}
- packed = get_packed_refs(refs->packed_ref_store);
+ packed = get_packed_refs(refs);
/* Remove refnames from the cache */
for_each_string_list_item(refname, refnames)
* All packed entries disappeared while we were
* acquiring the lock.
*/
- rollback_packed_refs(refs->packed_ref_store);
+ rollback_packed_refs(refs);
return 0;
}
/* Write what remains */
- ret = commit_packed_refs(refs->packed_ref_store);
+ ret = commit_packed_refs(refs);
if (ret)
strbuf_addf(err, "unable to overwrite old ref-pack file: %s",
strerror(errno));
if (!refnames->nr)
return 0;
- result = repack_without_refs(refs, refnames, &err);
+ result = repack_without_refs(refs->packed_ref_store, refnames, &err);
if (result) {
/*
* If we failed to rewrite the packed-refs file, then
}
}
- if (repack_without_refs(refs, &refs_to_delete, err)) {
+ if (repack_without_refs(refs->packed_ref_store, &refs_to_delete, err)) {
ret = TRANSACTION_GENERIC_ERROR;
goto cleanup;
}