run-command: wean auto_maintenance() functions off the_repository

The prepare_auto_maintenance() relies on the_repository to read
configurations. Since run_auto_maintenance() calls
prepare_auto_maintenance(), it also implicitly depends the_repository.

Add 'struct repository *' as a parameter to both functions and update
all callers to pass the_repository.

With no global repository dependencies left in this file, remove the
USE_THE_REPOSITORY_VARIABLE macro.

Suggested-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Burak Kaan Karaçay <bkkaracay@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Burak Kaan Karaçay
2026-03-12 17:44:37 +03:00
committed by Junio C Hamano
parent 05c324b92f
commit 9df3be8e2e
8 changed files with 21 additions and 16 deletions

View File

@@ -5,6 +5,8 @@
#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
@@ -227,12 +229,13 @@ int run_command(struct child_process *);
* 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