summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Haggerty <mhagger@alum.mit.edu>2017-06-23 09:01:33 +0200
committerJunio C Hamano <gitster@pobox.com>2017-06-23 13:27:32 -0700
commit0f199b1ee051e3e6854268841335287c3ad94b88 (patch)
tree039788e1f1e7aa5592a4f8df411057adfb6a8fd9
parentf3f97249402b74fd4cd3d0b008e0de2e14cd5b63 (diff)
downloadgit-0f199b1ee051e3e6854268841335287c3ad94b88.tar.gz
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>
-rw-r--r--refs/files-backend.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/refs/files-backend.c b/refs/files-backend.c
index 2b9d93d3b6..c206791b91 100644
--- a/refs/files-backend.c
+++ b/refs/files-backend.c
@@ -1621,19 +1621,19 @@ static int files_pack_refs(struct ref_store *ref_store, unsigned int flags)
*
* 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;
}
@@ -1643,11 +1643,11 @@ static int repack_without_refs(struct files_ref_store *refs,
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)
@@ -1658,12 +1658,12 @@ static int repack_without_refs(struct files_ref_store *refs,
* 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));
@@ -1681,7 +1681,7 @@ static int files_delete_refs(struct ref_store *ref_store, const char *msg,
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
@@ -3101,7 +3101,7 @@ static int files_transaction_finish(struct ref_store *ref_store,
}
}
- 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;
}