Files
git/builtin
Patrick Steinhardt 38a8fa5a9a builtin/maintenance: stop modifying global array of tasks
When configuring maintenance tasks run by git-maintenance(1) we do so by
modifying the global array of tasks directly. This is already quite bad
on its own, as global state makes for logic that is hard to follow.

Even more importantly though we use multiple different fields to track
whether or not a task should be run:

  - "enabled" tracks the "maintenance.*.enabled" config key. This field
    disables execution of a task, unless the user has explicitly asked
    for the task.

  - "selected_order" tracks the order in which jobs have been asked for
    by the user via the "--task=" command line option. It overrides
    everything else, but only has an effect if at least one job has been
    selected.

  - "schedule" tracks the schedule priority for a job, that is how often
    it should run. This field only plays a role when the user has passed
    the "--schedule=" command line option.

All of this makes it non-trivial to figure out which job really should
be running right now. The logic to configure these fields and the logic
that interprets them is distributed across multiple functions, making it
even harder to follow it.

Refactor the logic so that we stop modifying global state. Instead, we
now compute which jobs should be run in `initialize_task_config()`,
represented as an array of jobs to run that is stored in the options
structure. Like this, all logic becomes self-contained and any users of
this array only need to iterate through the tasks and execute them one
by one.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2025-06-03 08:30:49 -07:00
..
2025-05-19 16:02:46 -07:00
2024-12-13 07:33:36 -08:00
2025-05-12 14:22:49 -07:00
2025-01-28 13:02:22 -08:00
2025-05-12 14:22:49 -07:00
2024-12-18 10:44:30 -08:00
2025-05-12 14:22:49 -07:00
2024-12-18 10:44:31 -08:00
2025-05-08 12:36:32 -07:00
2025-02-04 09:51:41 -08:00
2025-03-29 01:04:40 -07:00
2025-04-24 17:25:34 -07:00
2024-12-18 10:44:30 -08:00
2025-01-28 13:02:22 -08:00