aboutsummaryrefslogtreecommitdiff
path: root/builtin
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2026-03-19 09:54:55 -0700
committerJunio C Hamano <gitster@pobox.com>2026-03-19 09:54:56 -0700
commita7a079c2c4bc7b269229a6ea6c147b6b2d5b2684 (patch)
tree204bfa2b742d068a08c53899a2a46f22db7f26b6 /builtin
parent2ca397fa7c4a9d4764749a785f71c9a379cd0e5a (diff)
parent9df3be8e2e7e2c9bf200de4bcfbd4e690a57f033 (diff)
downloadgit-a7a079c2c4bc7b269229a6ea6c147b6b2d5b2684.tar.xz
Merge branch 'bk/run-command-wo-the-repository'
The run_command() API lost its implicit dependencyon the singleton `the_repository` instance. * bk/run-command-wo-the-repository: run-command: wean auto_maintenance() functions off the_repository run-command: wean start_command() off the_repository
Diffstat (limited to 'builtin')
-rw-r--r--builtin/am.c2
-rw-r--r--builtin/commit.c2
-rw-r--r--builtin/fetch.c2
-rw-r--r--builtin/gc.c14
-rw-r--r--builtin/merge.c2
-rw-r--r--builtin/pull.c2
-rw-r--r--builtin/rebase.c4
-rw-r--r--builtin/receive-pack.c2
8 files changed, 18 insertions, 12 deletions
diff --git a/builtin/am.c b/builtin/am.c
index e0c767e223..9d0b51c651 100644
--- a/builtin/am.c
+++ b/builtin/am.c
@@ -1937,7 +1937,7 @@ next:
*/
if (!state->rebasing) {
am_destroy(state);
- run_auto_maintenance(state->quiet);
+ run_auto_maintenance(the_repository, state->quiet);
}
}
diff --git a/builtin/commit.c b/builtin/commit.c
index 844bdcc728..7b23c1f883 100644
--- a/builtin/commit.c
+++ b/builtin/commit.c
@@ -1958,7 +1958,7 @@ int cmd_commit(int argc,
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) {
diff --git a/builtin/fetch.c b/builtin/fetch.c
index 8a36cf67b5..4795b2a13c 100644
--- a/builtin/fetch.c
+++ b/builtin/fetch.c
@@ -2873,7 +2873,7 @@ int cmd_fetch(int argc,
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:
diff --git a/builtin/gc.c b/builtin/gc.c
index fb329c2cff..5d8d358f7a 100644
--- a/builtin/gc.c
+++ b/builtin/gc.c
@@ -1030,7 +1030,7 @@ int cmd_gc(int argc,
struct child_process repack_cmd = CHILD_PROCESS_INIT;
repack_cmd.git_cmd = 1;
- repack_cmd.close_object_store = 1;
+ repack_cmd.odb_to_close = the_repository->objects;
strvec_pushv(&repack_cmd.args, repack_args.v);
if (run_command(&repack_cmd))
die(FAILED_RUN, repack_args.v[0]);
@@ -1199,7 +1199,8 @@ static int run_write_commit_graph(struct maintenance_run_opts *opts)
{
struct child_process child = CHILD_PROCESS_INIT;
- child.git_cmd = child.close_object_store = 1;
+ child.git_cmd = 1;
+ child.odb_to_close = the_repository->objects;
strvec_pushl(&child.args, "commit-graph", "write",
"--split", "--reachable", NULL);
@@ -1268,7 +1269,8 @@ static int maintenance_task_gc_background(struct maintenance_run_opts *opts,
{
struct child_process child = CHILD_PROCESS_INIT;
- child.git_cmd = child.close_object_store = 1;
+ child.git_cmd = 1;
+ child.odb_to_close = the_repository->objects;
strvec_push(&child.args, "gc");
if (opts->auto_flag)
@@ -1484,7 +1486,8 @@ static int multi_pack_index_expire(struct maintenance_run_opts *opts)
{
struct child_process child = CHILD_PROCESS_INIT;
- child.git_cmd = child.close_object_store = 1;
+ child.git_cmd = 1;
+ child.odb_to_close = the_repository->objects;
strvec_pushl(&child.args, "multi-pack-index", "expire", NULL);
if (opts->quiet)
@@ -1542,7 +1545,8 @@ static int multi_pack_index_repack(struct maintenance_run_opts *opts)
{
struct child_process child = CHILD_PROCESS_INIT;
- child.git_cmd = child.close_object_store = 1;
+ child.git_cmd = 1;
+ child.odb_to_close = the_repository->objects;
strvec_pushl(&child.args, "multi-pack-index", "repack", NULL);
if (opts->quiet)
diff --git a/builtin/merge.c b/builtin/merge.c
index 4e456a381c..2cbce56f8d 100644
--- a/builtin/merge.c
+++ b/builtin/merge.c
@@ -506,7 +506,7 @@ static void finish(struct commit *head_commit,
* 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) {
diff --git a/builtin/pull.c b/builtin/pull.c
index 6ad420ce6f..7e67fdce97 100644
--- a/builtin/pull.c
+++ b/builtin/pull.c
@@ -454,7 +454,7 @@ static int run_fetch(const char *repo, const char **refspecs)
} else if (*refspecs)
BUG("refspecs without repo?");
cmd.git_cmd = 1;
- cmd.close_object_store = 1;
+ cmd.odb_to_close = the_repository->objects;
return run_command(&cmd);
}
diff --git a/builtin/rebase.c b/builtin/rebase.c
index c487e10907..8c1316db38 100644
--- a/builtin/rebase.c
+++ b/builtin/rebase.c
@@ -562,7 +562,9 @@ static int finish_rebase(struct rebase_options *opts)
* 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;
diff --git a/builtin/receive-pack.c b/builtin/receive-pack.c
index d6225df890..e34edff406 100644
--- a/builtin/receive-pack.c
+++ b/builtin/receive-pack.c
@@ -2727,7 +2727,7 @@ int cmd_receive_pack(int argc,
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;