aboutsummaryrefslogtreecommitdiffstats
path: root/builtin
diff options
context:
space:
mode:
authorPatrick Steinhardt <ps@pks.im>2025-06-03 16:01:12 +0200
committerJunio C Hamano <gitster@pobox.com>2025-06-03 08:30:49 -0700
commita7c86d328ffe2d93cb1bfaf557dba7a2034ec17b (patch)
tree5fb0ee82f9638de600ee2f9992b00266b61d8931 /builtin
parent1bb6bdb646583a2fc2e0e6436f5cdabdd4d14189 (diff)
downloadgit-a7c86d328ffe2d93cb1bfaf557dba7a2034ec17b.tar.gz
builtin/maintenance: mark "--task=" and "--schedule=" as incompatible
The "--task=" option explicitly allows the user to say which maintenance tasks should be run, whereas "--schedule=" only respects the maintenance strategy configured for a specific repository. As such, it is not sensible to accept both options at the same time. Mark them as incompatible with one another. While at it, also convert the existing logic that marks "--auto" and "--schedule=" as incompatible to use `die_for_incompatible_opt2()`. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin')
-rw-r--r--builtin/gc.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/builtin/gc.c b/builtin/gc.c
index c4af9b1128..57d7602596 100644
--- a/builtin/gc.c
+++ b/builtin/gc.c
@@ -1785,8 +1785,10 @@ static int maintenance_run(int argc, const char **argv, const char *prefix,
builtin_maintenance_run_usage,
PARSE_OPT_STOP_AT_NON_OPTION);
- if (opts.auto_flag && opts.schedule)
- die(_("use at most one of --auto and --schedule=<frequency>"));
+ die_for_incompatible_opt2(opts.auto_flag, "--auto",
+ opts.schedule, "--schedule=");
+ die_for_incompatible_opt2(selected_tasks.nr, "--task=",
+ opts.schedule, "--schedule=");
gc_config(&cfg);
initialize_task_config(&selected_tasks, opts.schedule);