*/
if (!state->rebasing) {
am_destroy(state);
- run_auto_maintenance(state->quiet);
+ run_auto_maintenance(the_repository, state->quiet);
}
}
git_test_write_commit_graph_or_die(the_repository->objects->sources);
repo_rerere(the_repository, 0);
- run_auto_maintenance(quiet);
+ run_auto_maintenance(the_repository, quiet);
run_commit_hook(use_editor, repo_get_index_file(the_repository),
NULL, "post-commit", NULL);
if (amend && !no_post_rewrite) {
if (opt_val != 0)
git_config_push_parameter("maintenance.incremental-repack.auto=-1");
}
- run_auto_maintenance(verbosity < 0);
+ run_auto_maintenance(the_repository, verbosity < 0);
}
cleanup:
* We ignore errors in 'gc --auto', since the
* user should see them.
*/
- run_auto_maintenance(verbosity < 0);
+ run_auto_maintenance(the_repository, verbosity < 0);
}
}
if (new_head && show_diffstat) {
* We ignore errors in 'git maintenance run --auto', since the
* user should see them.
*/
- run_auto_maintenance(!(opts->flags & (REBASE_NO_QUIET|REBASE_VERBOSE)));
+ run_auto_maintenance(the_repository,
+ !(opts->flags & (REBASE_NO_QUIET|REBASE_VERBOSE)));
+
if (opts->type == REBASE_MERGE) {
struct replay_opts replay = REPLAY_OPTS_INIT;
if (auto_gc) {
struct child_process proc = CHILD_PROCESS_INIT;
- if (prepare_auto_maintenance(1, &proc)) {
+ if (prepare_auto_maintenance(the_repository, 1, &proc)) {
proc.no_stdin = 1;
proc.stdout_to_stderr = 1;
proc.err = use_sideband ? -1 : 0;
-#define USE_THE_REPOSITORY_VARIABLE
#define DISABLE_SIGN_COMPARE_WARNINGS
#include "git-compat-util.h"
trace2_region_leave(tr2_category, tr2_label, NULL);
}
-int prepare_auto_maintenance(int quiet, struct child_process *maint)
+int prepare_auto_maintenance(struct repository *r, int quiet,
+ struct child_process *maint)
{
int enabled, auto_detach;
- if (!repo_config_get_bool(the_repository, "maintenance.auto", &enabled) &&
+ if (!repo_config_get_bool(r, "maintenance.auto", &enabled) &&
!enabled)
return 0;
* honoring `gc.autoDetach`. This is somewhat weird, but required to
* retain behaviour from when we used to run git-gc(1) here.
*/
- if (repo_config_get_bool(the_repository, "maintenance.autodetach", &auto_detach) &&
- repo_config_get_bool(the_repository, "gc.autodetach", &auto_detach))
+ if (repo_config_get_bool(r, "maintenance.autodetach", &auto_detach) &&
+ repo_config_get_bool(r, "gc.autodetach", &auto_detach))
auto_detach = git_env_bool("GIT_TEST_MAINT_AUTO_DETACH", true);
maint->git_cmd = 1;
- maint->odb_to_close = the_repository->objects;
+ maint->odb_to_close = r->objects;
strvec_pushl(&maint->args, "maintenance", "run", "--auto", NULL);
strvec_push(&maint->args, quiet ? "--quiet" : "--no-quiet");
strvec_push(&maint->args, auto_detach ? "--detach" : "--no-detach");
return 1;
}
-int run_auto_maintenance(int quiet)
+int run_auto_maintenance(struct repository *r, int quiet)
{
struct child_process maint = CHILD_PROCESS_INIT;
- if (!prepare_auto_maintenance(quiet, &maint))
+ if (!prepare_auto_maintenance(r, quiet, &maint))
return 0;
return run_command(&maint);
}
#include "strvec.h"
+struct repository;
+
/**
* The run-command API offers a versatile tool to run sub-processes with
* redirected input and output as well as with a modified environment
* process has been prepared and is ready to run, or 0 in case auto-maintenance
* should be skipped.
*/
-int prepare_auto_maintenance(int quiet, struct child_process *maint);
+int prepare_auto_maintenance(struct repository *r, int quiet,
+ struct child_process *maint);
/*
* Trigger an auto-gc
*/
-int run_auto_maintenance(int quiet);
+int run_auto_maintenance(struct repository *r, int quiet);
/**
* Execute the given command, sending "in" to its stdin, and capturing its