aboutsummaryrefslogtreecommitdiffstats
path: root/refs/debug.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2025-11-08 10:05:35 -0800
committerJunio C Hamano <gitster@pobox.com>2025-11-08 10:05:37 -0800
commitf2414e11feb8833fd51dc7dee11b1c99c0a54821 (patch)
tree8075b2f96403a9277f4f17ae6f8d697df4aad800 /refs/debug.c
parentMerge branch 'en/ort-rename-another-fix' into jch (diff)
parentmaintenance: add 'is-needed' subcommand (diff)
downloadgit-f2414e11feb8833fd51dc7dee11b1c99c0a54821.tar.gz
git-f2414e11feb8833fd51dc7dee11b1c99c0a54821.zip
Merge branch 'kn/maintenance-is-needed' into jch
"git maintenance" command learned "is-needed" subcommand to tell if it is necessary to perform various maintenance tasks. * kn/maintenance-is-needed: maintenance: add 'is-needed' subcommand maintenance: add checking logic in `pack_refs_condition()` refs: add a `optimize_required` field to `struct ref_storage_be` reftable/stack: add function to check if optimization is required reftable/stack: return stack segments directly
Diffstat (limited to 'refs/debug.c')
-rw-r--r--refs/debug.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/refs/debug.c b/refs/debug.c
index 54f409c249..3e31228c9a 100644
--- a/refs/debug.c
+++ b/refs/debug.c
@@ -132,6 +132,17 @@ static int debug_optimize(struct ref_store *ref_store, struct refs_optimize_opts
return res;
}
+static int debug_optimize_required(struct ref_store *ref_store,
+ struct refs_optimize_opts *opts,
+ bool *required)
+{
+ struct debug_ref_store *drefs = (struct debug_ref_store *)ref_store;
+ int res = drefs->refs->be->optimize_required(drefs->refs, opts, required);
+ trace_printf_key(&trace_refs, "optimize_required: %s, res: %d\n",
+ required ? "yes" : "no", res);
+ return res;
+}
+
static int debug_rename_ref(struct ref_store *ref_store, const char *oldref,
const char *newref, const char *logmsg)
{
@@ -440,6 +451,8 @@ struct ref_storage_be refs_be_debug = {
.transaction_abort = debug_transaction_abort,
.optimize = debug_optimize,
+ .optimize_required = debug_optimize_required,
+
.rename_ref = debug_rename_ref,
.copy_ref = debug_copy_ref,