1- #define USE_THE_REPOSITORY_VARIABLE
21#define DISABLE_SIGN_COMPARE_WARNINGS
32
43#include "git-compat-util.h"
@@ -742,8 +741,8 @@ int start_command(struct child_process *cmd)
742741
743742 fflush (NULL );
744743
745- if (cmd -> close_object_store )
746- odb_close (the_repository -> objects );
744+ if (cmd -> odb_to_close )
745+ odb_close (cmd -> odb_to_close );
747746
748747#ifndef GIT_WINDOWS_NATIVE
749748{
@@ -1937,11 +1936,12 @@ void run_processes_parallel(const struct run_process_parallel_opts *opts)
19371936 trace2_region_leave (tr2_category , tr2_label , NULL );
19381937}
19391938
1940- int prepare_auto_maintenance (int quiet , struct child_process * maint )
1939+ int prepare_auto_maintenance (struct repository * r , int quiet ,
1940+ struct child_process * maint )
19411941{
19421942 int enabled , auto_detach ;
19431943
1944- if (!repo_config_get_bool (the_repository , "maintenance.auto" , & enabled ) &&
1944+ if (!repo_config_get_bool (r , "maintenance.auto" , & enabled ) &&
19451945 !enabled )
19461946 return 0 ;
19471947
@@ -1950,23 +1950,23 @@ int prepare_auto_maintenance(int quiet, struct child_process *maint)
19501950 * honoring `gc.autoDetach`. This is somewhat weird, but required to
19511951 * retain behaviour from when we used to run git-gc(1) here.
19521952 */
1953- if (repo_config_get_bool (the_repository , "maintenance.autodetach" , & auto_detach ) &&
1954- repo_config_get_bool (the_repository , "gc.autodetach" , & auto_detach ))
1953+ if (repo_config_get_bool (r , "maintenance.autodetach" , & auto_detach ) &&
1954+ repo_config_get_bool (r , "gc.autodetach" , & auto_detach ))
19551955 auto_detach = git_env_bool ("GIT_TEST_MAINT_AUTO_DETACH" , true);
19561956
19571957 maint -> git_cmd = 1 ;
1958- maint -> close_object_store = 1 ;
1958+ maint -> odb_to_close = r -> objects ;
19591959 strvec_pushl (& maint -> args , "maintenance" , "run" , "--auto" , NULL );
19601960 strvec_push (& maint -> args , quiet ? "--quiet" : "--no-quiet" );
19611961 strvec_push (& maint -> args , auto_detach ? "--detach" : "--no-detach" );
19621962
19631963 return 1 ;
19641964}
19651965
1966- int run_auto_maintenance (int quiet )
1966+ int run_auto_maintenance (struct repository * r , int quiet )
19671967{
19681968 struct child_process maint = CHILD_PROCESS_INIT ;
1969- if (!prepare_auto_maintenance (quiet , & maint ))
1969+ if (!prepare_auto_maintenance (r , quiet , & maint ))
19701970 return 0 ;
19711971 return run_command (& maint );
19721972}
0 commit comments