MCPcopy Create free account
hub / github.com/git/git / prepare_auto_maintenance

Function prepare_auto_maintenance

run-command.c:1956–1985  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1954}
1955
1956int prepare_auto_maintenance(struct repository *r, int quiet,
1957 struct child_process *maint)
1958{
1959 int enabled = 1, auto_detach;
1960
1961 if (repo_config_get_bool(r, "maintenance.auto", &enabled)) {
1962 int gc_threshold;
1963 if (!repo_config_get_int(r, "gc.auto", &gc_threshold))
1964 enabled = gc_threshold > 0;
1965 }
1966 if (!enabled)
1967 return 0;
1968
1969 /*
1970 * When `maintenance.autoDetach` isn't set, then we fall back to
1971 * honoring `gc.autoDetach`. This is somewhat weird, but required to
1972 * retain behaviour from when we used to run git-gc(1) here.
1973 */
1974 if (repo_config_get_bool(r, "maintenance.autodetach", &auto_detach) &&
1975 repo_config_get_bool(r, "gc.autodetach", &auto_detach))
1976 auto_detach = git_env_bool("GIT_TEST_MAINT_AUTO_DETACH", true);
1977
1978 maint->git_cmd = 1;
1979 maint->odb_to_close = r->objects;
1980 strvec_pushl(&maint->args, "maintenance", "run", "--auto", NULL);
1981 strvec_push(&maint->args, quiet ? "--quiet" : "--no-quiet");
1982 strvec_push(&maint->args, auto_detach ? "--detach" : "--no-detach");
1983
1984 return 1;
1985}
1986
1987int run_auto_maintenance(struct repository *r, int quiet)
1988{

Callers 2

run_auto_maintenanceFunction · 0.85
cmd_receive_packFunction · 0.85

Calls 5

repo_config_get_boolFunction · 0.85
repo_config_get_intFunction · 0.85
git_env_boolFunction · 0.85
strvec_pushlFunction · 0.85
strvec_pushFunction · 0.85

Tested by

no test coverage detected