+
* `none`: This strategy implies no tasks are run at all. This is the default
strategy for scheduled maintenance.
+* `gc`: This strategy runs the `gc` task. This is the default strategy for
+ manual maintenance.
* `incremental`: This setting optimizes for performing small maintenance
activities that do not delete any data. This does not schedule the `gc`
task, but runs the `prefetch` and `commit-graph` tasks hourly, the
static const struct maintenance_strategy none_strategy = { 0 };
-static const struct maintenance_strategy default_strategy = {
+static const struct maintenance_strategy gc_strategy = {
.tasks = {
[TASK_GC] = {
- .type = MAINTENANCE_TYPE_MANUAL,
+ .type = MAINTENANCE_TYPE_MANUAL | MAINTENANCE_TYPE_SCHEDULED,
+ .schedule = SCHEDULE_DAILY,
},
},
};
{
if (!strcasecmp(name, "incremental"))
return incremental_strategy;
+ if (!strcasecmp(name, "gc"))
+ return gc_strategy;
die(_("unknown maintenance strategy: '%s'"), name);
}
strategy = none_strategy;
type = MAINTENANCE_TYPE_SCHEDULED;
} else {
- strategy = default_strategy;
+ strategy = gc_strategy;
type = MAINTENANCE_TYPE_MANUAL;
}
git gc --quiet --no-detach --skip-foreground-tasks
EOF
- test_strategy incremental --schedule=weekly <<-\EOF
+ test_strategy incremental --schedule=weekly <<-\EOF &&
git pack-refs --all --prune
git prune-packed --quiet
git multi-pack-index write --no-progress
git multi-pack-index repack --no-progress --batch-size=1
git commit-graph write --split --reachable --no-progress
EOF
+
+ test_strategy gc <<-\EOF &&
+ git pack-refs --all --prune
+ git reflog expire --all
+ git gc --quiet --no-detach --skip-foreground-tasks
+ EOF
+
+ test_strategy gc --schedule=weekly <<-\EOF
+ git pack-refs --all --prune
+ git reflog expire --all
+ git gc --quiet --no-detach --skip-foreground-tasks
+ EOF
)
'