aboutsummaryrefslogtreecommitdiffstats
path: root/refs/files-backend.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2025-11-04 07:31:19 -0800
committerJunio C Hamano <gitster@pobox.com>2025-11-04 07:31:19 -0800
commit5ab9228d7a2de8896948232f2b32c34b4e192166 (patch)
tree65183e13ad8aeebb64f2e0ec08752352bb7bbdab /refs/files-backend.c
parentSync with Git 2.52-rc0 (diff)
downloadgit-5ab9228d7a2de8896948232f2b32c34b4e192166.tar.gz
git-5ab9228d7a2de8896948232f2b32c34b4e192166.zip
Revert "Merge branch 'kn/refs-optim-cleanup' into next"
This reverts commit 8c2d7a4413436c0f91af0c0ab978cba8af905696, reversing changes made to 8ac48a10de61267858d66383c34833e55a5e9d02.
Diffstat (limited to 'refs/files-backend.c')
-rw-r--r--refs/files-backend.c22
1 files changed, 16 insertions, 6 deletions
diff --git a/refs/files-backend.c b/refs/files-backend.c
index a1e70b1c10..f4809edda8 100644
--- a/refs/files-backend.c
+++ b/refs/files-backend.c
@@ -1355,7 +1355,7 @@ static void prune_refs(struct files_ref_store *refs, struct ref_to_prune **refs_
*/
static int should_pack_ref(struct files_ref_store *refs,
const struct reference *ref,
- struct refs_optimize_opts *opts)
+ struct pack_refs_opts *opts)
{
struct string_list_item *item;
@@ -1383,7 +1383,7 @@ static int should_pack_ref(struct files_ref_store *refs,
}
static int should_pack_refs(struct files_ref_store *refs,
- struct refs_optimize_opts *opts)
+ struct pack_refs_opts *opts)
{
struct ref_iterator *iter;
size_t packed_size;
@@ -1391,7 +1391,7 @@ static int should_pack_refs(struct files_ref_store *refs,
size_t limit;
int ret;
- if (!(opts->flags & REFS_OPTIMIZE_AUTO))
+ if (!(opts->flags & PACK_REFS_AUTO))
return 1;
ret = packed_refs_size(refs->packed_ref_store, &packed_size);
@@ -1444,8 +1444,8 @@ static int should_pack_refs(struct files_ref_store *refs,
return 0;
}
-static int files_optimize(struct ref_store *ref_store,
- struct refs_optimize_opts *opts)
+static int files_pack_refs(struct ref_store *ref_store,
+ struct pack_refs_opts *opts)
{
struct files_ref_store *refs =
files_downcast(ref_store, REF_STORE_WRITE | REF_STORE_ODB,
@@ -1488,7 +1488,7 @@ static int files_optimize(struct ref_store *ref_store,
iter->ref.name, err.buf);
/* Schedule the loose reference for pruning if requested. */
- if ((opts->flags & REFS_OPTIMIZE_PRUNE)) {
+ if ((opts->flags & PACK_REFS_PRUNE)) {
struct ref_to_prune *n;
FLEX_ALLOC_STR(n, name, iter->ref.name);
oidcpy(&n->oid, iter->ref.oid);
@@ -1512,6 +1512,15 @@ static int files_optimize(struct ref_store *ref_store,
return 0;
}
+static int files_optimize(struct ref_store *ref_store, struct pack_refs_opts *opts)
+{
+ /*
+ * For the "files" backend, "optimizing" is the same as "packing".
+ * So, we just call the existing worker function for packing.
+ */
+ return files_pack_refs(ref_store, opts);
+}
+
/*
* People using contrib's git-new-workdir have .git/logs/refs ->
* /some/other/path/.git/logs/refs, and that may live on another device.
@@ -3981,6 +3990,7 @@ struct ref_storage_be refs_be_files = {
.transaction_finish = files_transaction_finish,
.transaction_abort = files_transaction_abort,
+ .pack_refs = files_pack_refs,
.optimize = files_optimize,
.rename_ref = files_rename_ref,
.copy_ref = files_copy_ref,