setup: stop using `the_repository` in `setup_git_env()`
Stop using `the_repository` in `setup_git_env()` and instead accept the repository as a parameter. The injection of `the_repository` is thus bumped one level higher, where callers now pass it in explicitly. Furthermore, the function is never used outside of "setup.c". Drop the declaration in "environment.h" and make it static. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>main
parent
7a6a82fba0
commit
27b76d1862
|
|
@ -147,8 +147,6 @@ void repo_config_values_init(struct repo_config_values *cfg);
|
|||
* Please do not add new global config variables here.
|
||||
*/
|
||||
# ifdef USE_THE_REPOSITORY_VARIABLE
|
||||
void setup_git_env(const char *git_dir);
|
||||
|
||||
/*
|
||||
* Returns true iff we have a configured git repository (either via
|
||||
* setup_git_directory, or in the environment via $GIT_DIR).
|
||||
|
|
|
|||
6
setup.c
6
setup.c
|
|
@ -1074,9 +1074,9 @@ static void setup_git_env_internal(struct repository *repo,
|
|||
fetch_if_missing = 0;
|
||||
}
|
||||
|
||||
void setup_git_env(const char *git_dir)
|
||||
static void setup_git_env(struct repository *repo, const char *git_dir)
|
||||
{
|
||||
setup_git_env_internal(the_repository, git_dir, false);
|
||||
setup_git_env_internal(repo, git_dir, false);
|
||||
}
|
||||
|
||||
static void set_git_dir_1(struct repository *repo, const char *path, bool skip_initializing_odb)
|
||||
|
|
@ -1988,7 +1988,7 @@ const char *setup_git_directory_gently(int *nongit_ok)
|
|||
const char *gitdir = getenv(GIT_DIR_ENVIRONMENT);
|
||||
if (!gitdir)
|
||||
gitdir = DEFAULT_GIT_DIR_ENVIRONMENT;
|
||||
setup_git_env(gitdir);
|
||||
setup_git_env(the_repository, gitdir);
|
||||
}
|
||||
if (startup_info->have_repository) {
|
||||
repo_set_hash_algo(the_repository, repo_fmt.hash_algo);
|
||||
|
|
|
|||
Loading…
Reference in New Issue