The `setup_git_env()` function is a trivial wrapper around
`setup_git_env_internal()` and has a single call site only. Drop the
function.
While at it, drop stale documentation in "environment.h" that points to
this function, even though it hasn't been exposed to callers outside of
"setup.c" since
43ad1047a9 (setup: stop using `the_repository` in
`setup_git_env()`, 2026-03-27) anymore.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
* `the_repository`. We should eventually get rid of these and make the
* dependency on a repository explicit:
*
- * - `setup_git_env()` ideally shouldn't exist as it modifies global state,
- * namely the environment. The current process shouldn't ever access that
- * state via envvars though, but should instead consult a `struct
- * repository`. When spawning new processes, we would ideally also pass a
- * `struct repository` and then set up the environment variables for the
- * child process, only.
- *
* - `have_git_dir()` should not have to exist at all. Instead, we should
* decide on whether or not we have a `struct repository`.
*
* Please do not add new global config variables here.
*/
# ifdef USE_THE_REPOSITORY_VARIABLE
+
/*
* Returns true iff we have a configured git repository (either via
* setup_git_directory, or in the environment via $GIT_DIR).
* points to the content of another. Unlike the other
* ref namespaces, this one can be changed by the
* GIT_REPLACE_REF_BASE environment variable. This
- * .namespace value will be overwritten in setup_git_env().
+ * .namespace value will be overwritten during repository
+ * setup.
*/
.ref = "refs/replace/",
.decoration = DECORATION_GRAFTED,
fetch_if_missing = 0;
}
-static void setup_git_env(struct repository *repo, const char *git_dir)
-{
- setup_git_env_internal(repo, git_dir, false);
-}
-
static void set_git_dir_1(struct repository *repo, const char *path, bool skip_initializing_odb)
{
xsetenv(GIT_DIR_ENVIRONMENT, path, 1);
const char *gitdir = getenv(GIT_DIR_ENVIRONMENT);
if (!gitdir)
gitdir = DEFAULT_GIT_DIR_ENVIRONMENT;
- setup_git_env(repo, gitdir);
+ setup_git_env_internal(repo, gitdir, false);
}
if (startup_info->have_repository) {
repo_set_hash_algo(repo, repo_fmt.hash_algo);