summaryrefslogtreecommitdiff
path: root/object.h
diff options
context:
space:
mode:
authorKarthik Nayak <karthik.188@gmail.com>2025-11-08 22:51:56 +0100
committerJunio C Hamano <gitster@pobox.com>2025-11-10 09:28:48 -0800
commit8c1ce2204cc755bdafec85aaa4ac9c5a686a8bf4 (patch)
tree07546d608dd8ecbfc41ca0da92a41885134caeff /object.h
parentf6c5ca387a7693b16158826d157178be0ba439dc (diff)
maintenance: add checking logic in `pack_refs_condition()`
The 'git-maintenance(1)' command supports an '--auto' flag. Usage of the flag ensures to run maintenance tasks only if certain thresholds are met. The heuristic is defined on a task level, wherein each task defines an 'auto_condition', which states if the task should be run. The 'pack-refs' task is hard-coded to return 1 as: 1. There was never a way to check if the reference backend needs to be optimized without actually performing the optimization. 2. We can pass in the '--auto' flag to 'git-pack-refs(1)' which would optimize based on heuristics. The previous commit added a `refs_optimize_required()` function, which can be used to check if a reference backend required optimization. Use this within `pack_refs_condition()`. This allows us to add a 'git maintenance is-needed' subcommand which can notify the user if maintenance is needed without actually performing the optimization. Without this change, the reference backend would always state that optimization is needed. Since we import 'revision.h', we need to remove the definition for 'SEEN' which is duplicated in the included header. Signed-off-by: Karthik Nayak <karthik.188@gmail.com> Acked-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'object.h')
-rw-r--r--object.h1
1 files changed, 0 insertions, 1 deletions
diff --git a/object.h b/object.h
index 1499f63d50..832299e763 100644
--- a/object.h
+++ b/object.h
@@ -79,7 +79,6 @@ void object_array_init(struct object_array *array);
* list-objects-filter.c: 21
* bloom.c: 2122
* builtin/fsck.c: 0--3
- * builtin/gc.c: 0
* builtin/index-pack.c: 2021
* reflog.c: 10--12
* builtin/show-branch.c: 0-------------------------------------------26