git/builtin
Karthik Nayak 28b83e6f08 maintenance: add 'is-needed' subcommand
The 'git-maintenance(1)' command provides tooling to run maintenance
tasks over Git repositories. The 'run' subcommand, as the name suggests,
runs the maintenance tasks. When used with the '--auto' flag, it uses
heuristics to determine if the required thresholds are met for running
said maintenance tasks.

There is however a lack of insight into these heuristics. Meaning, the
checks are linked to the execution.

Add a new 'is-needed' subcommand to 'git-maintenance(1)' which allows
users to simply check if it is needed to run maintenance without
performing it.

This subcommand can check if it is needed to run maintenance without
actually running it. Ideally it should be used with the '--auto' flag,
which would allow users to check if the thresholds required are met. The
subcommand also supports the '--task' flag which can be used to check
specific maintenance tasks.

While adding the respective tests in 't/t7900-maintenance.sh', remove a
duplicate of the test: 'worktree-prune task with --auto honors
maintenance.worktree-prune.auto'.

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>
2025-11-10 09:28:48 -08:00
..
add.c Merge branch 'jt/odb-transaction' 2025-10-02 12:26:11 -07:00
am.c color: use GIT_COLOR_* instead of numeric constants 2025-09-16 13:37:03 -07:00
annotate.c
apply.c builtin: use default hash when outside a repository 2025-07-01 14:58:24 -07:00
archive.c
backfill.c packfile: split up responsibilities of `reprepare_packed_git()` 2025-09-24 11:53:50 -07:00
bisect.c Merge branch 'ps/ref-peeled-tags' into kn/maintenance-is-needed 2025-11-04 07:38:27 -08:00
blame.c Merge branch 'jc/string-list-split' 2025-08-21 13:46:59 -07:00
branch.c color: use git_colorbool enum type to store colorbools 2025-09-16 17:59:53 -07:00
bugreport.c object-file: move `safe_create_leading_directories()` into "path.c" 2025-04-15 08:24:35 -07:00
bundle.c
cat-file.c Merge branch 'ps/remove-packfile-store-get-packs' 2025-10-30 08:00:19 -07:00
check-attr.c config: drop `git_config()` wrapper 2025-07-23 08:15:18 -07:00
check-ignore.c config: move Git config parsing into "environment.c" 2025-07-23 08:15:22 -07:00
check-mailmap.c config: move Git config parsing into "environment.c" 2025-07-23 08:15:22 -07:00
check-ref-format.c
checkout--worker.c config: move Git config parsing into "environment.c" 2025-07-23 08:15:22 -07:00
checkout-index.c config: move Git config parsing into "environment.c" 2025-07-23 08:15:22 -07:00
checkout.c refs: introduce wrapper struct for `each_ref_fn` 2025-11-04 07:32:24 -08:00
clean.c Merge branch 'jk/color-variable-fixes' 2025-09-29 11:40:35 -07:00
clone.c config: drop `git_config_set_multivar()` wrapper 2025-07-23 08:15:21 -07:00
column.c config: drop `git_config()` wrapper 2025-07-23 08:15:18 -07:00
commit-graph.c commit-graph: add new config for changed-paths & recommend it in scalar 2025-10-22 10:40:11 -07:00
commit-tree.c config: move Git config parsing into "environment.c" 2025-07-23 08:15:22 -07:00
commit.c Merge branch 'jk/color-variable-fixes' 2025-09-29 11:40:35 -07:00
config.c Merge branch 'ps/config-get-color-fixes' 2025-10-02 12:26:12 -07:00
count-objects.c packfile: introduce macro to iterate through packs 2025-10-16 14:42:39 -07:00
credential-cache--daemon.c config: drop `git_config_get_bool()` wrapper 2025-07-23 08:15:20 -07:00
credential-cache.c
credential-store.c config: drop `git_config_get_int()` wrapper 2025-07-23 08:15:20 -07:00
credential.c config: move Git config parsing into "environment.c" 2025-07-23 08:15:22 -07:00
describe.c refs: expose peeled object ID via the iterator 2025-11-04 07:32:25 -08:00
diagnose.c object-file: move `safe_create_leading_directories()` into "path.c" 2025-04-15 08:24:35 -07:00
diff-files.c config: drop `git_config()` wrapper 2025-07-23 08:15:18 -07:00
diff-index.c config: drop `git_config()` wrapper 2025-07-23 08:15:18 -07:00
diff-pairs.c builtin/diff-pairs: allow explicit diff queue flush 2025-03-03 08:17:47 -08:00
diff-tree.c config: drop `git_config()` wrapper 2025-07-23 08:15:18 -07:00
diff.c diff: --no-index should ignore the worktree 2025-08-09 17:22:01 -07:00
difftool.c odb: rename `repo_read_object_file()` 2025-07-01 14:46:38 -07:00
fast-export.c fast-export: handle all kinds of tag signatures 2025-10-13 08:51:42 -07:00
fast-import.c Merge branch 'ps/remove-packfile-store-get-packs' 2025-10-30 08:00:19 -07:00
fetch-pack.c builtin/fetch-pack: cleanup before return error 2025-06-04 08:52:25 -07:00
fetch.c refs: introduce wrapper struct for `each_ref_fn` 2025-11-04 07:32:24 -08:00
fmt-merge-msg.c builtin/fmt-merge-msg: stop depending on 'the_repository' 2025-08-11 09:19:40 -07:00
for-each-ref.c Merge branch 'ms/refs-list' 2025-08-22 13:13:20 -07:00
for-each-repo.c
fsck.c Merge branch 'ps/ref-peeled-tags' into kn/maintenance-is-needed 2025-11-04 07:38:27 -08:00
fsmonitor--daemon.c config: move Git config parsing into "environment.c" 2025-07-23 08:15:22 -07:00
gc.c maintenance: add 'is-needed' subcommand 2025-11-10 09:28:48 -08:00
get-tar-commit-id.c
grep.c builtin/grep: simplify how we preload packs 2025-10-16 14:42:39 -07:00
hash-object.c config: move Git config parsing into "environment.c" 2025-07-23 08:15:22 -07:00
help.c config: move Git config parsing into "environment.c" 2025-07-23 08:15:22 -07:00
hook.c config: move Git config parsing into "environment.c" 2025-07-23 08:15:22 -07:00
index-pack.c packfile: introduce function to load and add packfiles 2025-09-24 11:53:50 -07:00
init-db.c Merge branch 'ps/parse-options-integers' 2025-04-24 17:25:34 -07:00
interpret-trailers.c config: move Git config parsing into "environment.c" 2025-07-23 08:15:22 -07:00
last-modified.c last-modified: fix bug when some paths remain unhandled 2025-09-18 08:00:41 -07:00
log.c Merge branch 'kh/format-patch-range-diff-notes' 2025-10-14 12:56:09 -07:00
ls-files.c Merge branch 'ds/ls-files-lazy-unsparse' 2025-09-08 14:54:35 -07:00
ls-remote.c ref-filter: propagate peeled object ID 2025-11-04 07:32:25 -08:00
ls-tree.c use repo_get_oid_with_flags() 2025-09-10 14:29:49 -07:00
mailinfo.c
mailsplit.c
merge-base.c config: move Git config parsing into "environment.c" 2025-07-23 08:15:22 -07:00
merge-file.c Merge branch 'ps/object-file-wo-the-repository' 2025-08-05 11:53:55 -07:00
merge-index.c
merge-ours.c
merge-recursive.c builtin: also setup gently for --help-all 2025-08-08 11:13:12 -07:00
merge-tree.c Merge branch 'jc/strbuf-split' 2025-08-21 13:47:00 -07:00
merge.c Merge branch 'pw/3.0-commentchar-auto-deprecation' 2025-09-18 10:07:00 -07:00
mktag.c Merge branch 'ps/object-file-wo-the-repository' 2025-08-05 11:53:55 -07:00
mktree.c odb: introduce `odb_write_object()` 2025-07-16 22:16:15 -07:00
multi-pack-index.c Merge branch 'ps/object-store-midx-dedup-info' 2025-09-12 10:41:18 -07:00
mv.c config: drop `git_config()` wrapper 2025-07-23 08:15:18 -07:00
name-rev.c refs: introduce wrapper struct for `each_ref_fn` 2025-11-04 07:32:24 -08:00
notes.c Merge branch 'jc/strbuf-split' 2025-08-21 13:47:00 -07:00
pack-objects.c Merge branch 'ps/ref-peeled-tags' into kn/maintenance-is-needed 2025-11-04 07:38:27 -08:00
pack-redundant.c Merge branch 'ps/remove-packfile-store-get-packs' 2025-10-30 08:00:19 -07:00
pack-refs.c builtin/pack-refs: factor out core logic into a shared library 2025-09-19 10:02:55 -07:00
patch-id.c config: move Git config parsing into "environment.c" 2025-07-23 08:15:22 -07:00
prune-packed.c
prune.c Merge branch 'ps/object-file-wo-the-repository' 2025-08-05 11:53:55 -07:00
pull.c Merge branch 'ps/config-wo-the-repository' 2025-08-04 08:10:33 -07:00
push.c color: use git_colorbool enum type to store colorbools 2025-09-16 17:59:53 -07:00
range-diff.c Merge branch 'kh/format-patch-range-diff-notes' 2025-10-14 12:56:09 -07:00
read-tree.c config: move Git config parsing into "environment.c" 2025-07-23 08:15:22 -07:00
rebase.c Merge branch 'jk/setup-revisions-freefix' 2025-09-29 11:40:34 -07:00
receive-pack.c refs: introduce wrapper struct for `each_ref_fn` 2025-11-04 07:32:24 -08:00
reflog.c Merge branch 'ml/reflog-write-committer-info-fix' 2025-10-08 12:17:54 -07:00
refs.c Merge branch 'ms/refs-optimize' 2025-10-02 12:26:12 -07:00
remote-ext.c
remote-fd.c
remote.c refs: introduce wrapper struct for `each_ref_fn` 2025-11-04 07:32:24 -08:00
repack.c builtin/repack.c: clean up unused `#include`s 2025-10-16 10:08:57 -07:00
replace.c refs: introduce wrapper struct for `each_ref_fn` 2025-11-04 07:32:24 -08:00
replay.c repo_logmsg_reencode: fix memory leak when use repo_logmsg_reencode () 2025-06-05 08:35:22 -07:00
repo.c refs: introduce wrapper struct for `each_ref_fn` 2025-11-04 07:32:24 -08:00
rerere.c config: drop `git_config()` wrapper 2025-07-23 08:15:18 -07:00
reset.c Merge branch 'lm/add-p-context' 2025-08-04 08:10:33 -07:00
rev-list.c Merge branch 'ps/config-wo-the-repository' 2025-08-04 08:10:33 -07:00
rev-parse.c Merge branch 'ps/ref-peeled-tags' into kn/maintenance-is-needed 2025-11-04 07:38:27 -08:00
revert.c Merge branch 'pw/3.0-commentchar-auto-deprecation' 2025-09-18 10:07:00 -07:00
rm.c config: move Git config parsing into "environment.c" 2025-07-23 08:15:22 -07:00
send-pack.c config: move Git config parsing into "environment.c" 2025-07-23 08:15:22 -07:00
shortlog.c config: drop `git_config()` wrapper 2025-07-23 08:15:18 -07:00
show-branch.c refs: introduce wrapper struct for `each_ref_fn` 2025-11-04 07:32:24 -08:00
show-index.c builtin: use default hash when outside a repository 2025-07-01 14:58:24 -07:00
show-ref.c builtin/show-ref: convert to use `reference_get_peeled_oid()` 2025-11-04 07:32:25 -08:00
sparse-checkout.c sparse-checkout: add --verbose option to 'clean' 2025-09-15 12:10:56 -07:00
stash.c Merge branch 'dk/stash-apply-index' 2025-09-29 11:40:35 -07:00
stripspace.c config: drop `git_config()` wrapper 2025-07-23 08:15:18 -07:00
submodule--helper.c refs: introduce wrapper struct for `each_ref_fn` 2025-11-04 07:32:24 -08:00
symbolic-ref.c config: move Git config parsing into "environment.c" 2025-07-23 08:15:22 -07:00
tag.c ref-filter: propagate peeled object ID 2025-11-04 07:32:25 -08:00
unpack-file.c config: move Git config parsing into "environment.c" 2025-07-23 08:15:22 -07:00
unpack-objects.c odb: add transaction interface 2025-09-16 11:37:06 -07:00
update-index.c odb: add transaction interface 2025-09-16 11:37:06 -07:00
update-ref.c config: move Git config parsing into "environment.c" 2025-07-23 08:15:22 -07:00
update-server-info.c config: move Git config parsing into "environment.c" 2025-07-23 08:15:22 -07:00
upload-archive.c
upload-pack.c
var.c Merge branch 'jc/string-list-split' 2025-08-21 13:46:59 -07:00
verify-commit.c config: move Git config parsing into "environment.c" 2025-07-23 08:15:22 -07:00
verify-pack.c config: move Git config parsing into "environment.c" 2025-07-23 08:15:22 -07:00
verify-tag.c ref-filter: propagate peeled object ID 2025-11-04 07:32:25 -08:00
worktree.c refs: introduce wrapper struct for `each_ref_fn` 2025-11-04 07:32:24 -08:00
write-tree.c config: move Git config parsing into "environment.c" 2025-07-23 08:15:22 -07:00