summaryrefslogtreecommitdiff
path: root/Documentation/git-maintenance.txt
diff options
context:
space:
mode:
authorDerrick Stolee <dstolee@microsoft.com>2020-09-11 17:49:15 (GMT)
committerJunio C Hamano <gitster@pobox.com>2020-09-25 17:59:44 (GMT)
commitb08ff1fee000230ad22fee823aabff2613bd4e62 (patch)
tree29e8e198383ab652429d07e8d724ef9915ccef0c /Documentation/git-maintenance.txt
parent1942d48380fec53f76361e9adebef15b5db9628a (diff)
downloadgit-b08ff1fee000230ad22fee823aabff2613bd4e62.zip
git-b08ff1fee000230ad22fee823aabff2613bd4e62.tar.gz
git-b08ff1fee000230ad22fee823aabff2613bd4e62.tar.bz2
maintenance: add --schedule option and config
Maintenance currently triggers when certain data-size thresholds are met, such as number of pack-files or loose objects. Users may want to run certain maintenance tasks based on frequency instead. For example, a user may want to perform a 'prefetch' task every hour, or 'gc' task every day. To help these users, update the 'git maintenance run' command to include a '--schedule=<frequency>' option. The allowed frequencies are 'hourly', 'daily', and 'weekly'. These values are also allowed in a new config value 'maintenance.<task>.schedule'. The 'git maintenance run --schedule=<frequency>' checks the '*.schedule' config value for each enabled task to see if the configured frequency is at least as frequent as the frequency from the '--schedule' argument. We use the following order, for full clarity: 'hourly' > 'daily' > 'weekly' Use new 'enum schedule_priority' to track these values numerically. The following cron table would run the scheduled tasks with the correct frequencies: 0 1-23 * * * git -C <repo> maintenance run --schedule=hourly 0 0 * * 1-6 git -C <repo> maintenance run --schedule=daily 0 0 * * 0 git -C <repo> maintenance run --schedule=weekly This cron schedule will run --schedule=hourly every hour except at midnight. This avoids a concurrent run with the --schedule=daily that runs at midnight every day except the first day of the week. This avoids a concurrent run with the --schedule=weekly that runs at midnight on the first day of the week. Since --schedule=daily also runs the 'hourly' tasks and --schedule=weekly runs the 'hourly' and 'daily' tasks, we will still see all tasks run with the proper frequencies. Signed-off-by: Derrick Stolee <dstolee@microsoft.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'Documentation/git-maintenance.txt')
-rw-r--r--Documentation/git-maintenance.txt13
1 files changed, 12 insertions, 1 deletions
diff --git a/Documentation/git-maintenance.txt b/Documentation/git-maintenance.txt
index 3f5d894..ed94f66 100644
--- a/Documentation/git-maintenance.txt
+++ b/Documentation/git-maintenance.txt
@@ -110,7 +110,18 @@ OPTIONS
only if certain thresholds are met. For example, the `gc` task
runs when the number of loose objects exceeds the number stored
in the `gc.auto` config setting, or when the number of pack-files
- exceeds the `gc.autoPackLimit` config setting.
+ exceeds the `gc.autoPackLimit` config setting. Not compatible with
+ the `--schedule` option.
+
+--schedule::
+ When combined with the `run` subcommand, run maintenance tasks
+ only if certain time conditions are met, as specified by the
+ `maintenance.<task>.schedule` config value for each `<task>`.
+ This config value specifies a number of seconds since the last
+ time that task ran, according to the `maintenance.<task>.lastRun`
+ config value. The tasks that are tested are those provided by
+ the `--task=<task>` option(s) or those with
+ `maintenance.<task>.enabled` set to true.
--quiet::
Do not report progress or other information over `stderr`.