| 1954 | } |
| 1955 | |
| 1956 | int 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 | |
| 1987 | int run_auto_maintenance(struct repository *r, int quiet) |
| 1988 | { |
no test coverage detected