Merge branch 'ps/setup-wo-the-repository' into next

Many uses of the_repository has been updated to use a more
appropriate struct repository instance in setup.c codepath.

* ps/setup-wo-the-repository:
  setup: stop using `the_repository` in `init_db()`
  setup: stop using `the_repository` in `create_reference_database()`
  setup: stop using `the_repository` in `initialize_repository_version()`
  setup: stop using `the_repository` in `check_repository_format()`
  setup: stop using `the_repository` in `upgrade_repository_format()`
  setup: stop using `the_repository` in `setup_git_directory()`
  setup: stop using `the_repository` in `setup_git_directory_gently()`
  setup: stop using `the_repository` in `setup_git_env()`
  setup: stop using `the_repository` in `set_git_work_tree()`
  setup: stop using `the_repository` in `setup_work_tree()`
  setup: stop using `the_repository` in `enter_repo()`
  setup: stop using `the_repository` in `verify_non_filename()`
  setup: stop using `the_repository` in `verify_filename()`
  setup: stop using `the_repository` in `path_inside_repo()`
  setup: stop using `the_repository` in `prefix_path()`
  setup: stop using `the_repository` in `is_inside_work_tree()`
  setup: stop using `the_repository` in `is_inside_git_dir()`
  setup: replace use of `the_repository` in static functions
This commit is contained in:
Junio C Hamano
2026-05-21 13:39:24 +09:00
84 changed files with 403 additions and 384 deletions

10
git.c
View File

@@ -84,7 +84,7 @@ static int list_cmds(const char *spec)
* Set up the repository so we can pick up any repo-level config (like
* completion.commands).
*/
setup_git_directory_gently(&nongit);
setup_git_directory_gently(the_repository, &nongit);
while (*spec) {
const char *sep = strchrnul(spec, ',');
@@ -386,7 +386,7 @@ static int handle_alias(struct strvec *args, struct string_list *expanded_aliase
int nongit_ok;
/* Aliases expect GIT_PREFIX, GIT_DIR etc to be set */
setup_git_directory_gently(&nongit_ok);
setup_git_directory_gently(the_repository, &nongit_ok);
commit_pager_choice();
@@ -477,10 +477,10 @@ static int run_builtin(struct cmd_struct *p, int argc, const char **argv, struct
run_setup = RUN_SETUP_GENTLY;
if (run_setup & RUN_SETUP) {
prefix = setup_git_directory();
prefix = setup_git_directory(the_repository);
no_repo = 0;
} else if (run_setup & RUN_SETUP_GENTLY) {
prefix = setup_git_directory_gently(&no_repo);
prefix = setup_git_directory_gently(the_repository, &no_repo);
} else {
prefix = NULL;
}
@@ -497,7 +497,7 @@ static int run_builtin(struct cmd_struct *p, int argc, const char **argv, struct
commit_pager_choice();
if (!help && p->option & NEED_WORK_TREE)
setup_work_tree();
setup_work_tree(the_repository);
trace_argv_printf(argv, "trace: built-in: git");
trace2_cmd_name(p->cmd);