repo_set_worktree(repo, new_work_tree);
}
-const char *setup_git_directory_gently(int *nongit_ok)
+const char *setup_git_directory_gently(struct repository *repo, int *nongit_ok)
{
static struct strbuf cwd = STRBUF_INIT;
struct strbuf dir = STRBUF_INIT, gitdir = STRBUF_INIT, report = STRBUF_INIT;
* configuration (including the per-repo config file that we
* ignored previously).
*/
- repo_config_clear(the_repository);
+ repo_config_clear(repo);
/*
* Let's assume that we are in a git repository.
switch (setup_git_directory_gently_1(&dir, &gitdir, &report, 1)) {
case GIT_DIR_EXPLICIT:
- prefix = setup_explicit_git_dir(the_repository, gitdir.buf, &cwd, &repo_fmt, nongit_ok);
+ prefix = setup_explicit_git_dir(repo, gitdir.buf, &cwd, &repo_fmt, nongit_ok);
break;
case GIT_DIR_DISCOVERED:
if (dir.len < cwd.len && chdir(dir.buf))
die(_("cannot change to '%s'"), dir.buf);
- prefix = setup_discovered_git_dir(the_repository, gitdir.buf, &cwd, dir.len,
+ prefix = setup_discovered_git_dir(repo, gitdir.buf, &cwd, dir.len,
&repo_fmt, nongit_ok);
break;
case GIT_DIR_BARE:
if (dir.len < cwd.len && chdir(dir.buf))
die(_("cannot change to '%s'"), dir.buf);
- prefix = setup_bare_git_dir(the_repository, &cwd, dir.len, &repo_fmt, nongit_ok);
+ prefix = setup_bare_git_dir(repo, &cwd, dir.len, &repo_fmt, nongit_ok);
break;
case GIT_DIR_HIT_CEILING:
if (!nongit_ok)
startup_info->have_repository ||
/* GIT_DIR_EXPLICIT */
getenv(GIT_DIR_ENVIRONMENT)) {
- if (!the_repository->gitdir) {
+ if (!repo->gitdir) {
const char *gitdir = getenv(GIT_DIR_ENVIRONMENT);
if (!gitdir)
gitdir = DEFAULT_GIT_DIR_ENVIRONMENT;
- setup_git_env(the_repository, gitdir);
+ setup_git_env(repo, gitdir);
}
if (startup_info->have_repository) {
- repo_set_hash_algo(the_repository, repo_fmt.hash_algo);
- repo_set_compat_hash_algo(the_repository,
+ repo_set_hash_algo(repo, repo_fmt.hash_algo);
+ repo_set_compat_hash_algo(repo,
repo_fmt.compat_hash_algo);
- repo_set_ref_storage_format(the_repository,
+ repo_set_ref_storage_format(repo,
repo_fmt.ref_storage_format,
repo_fmt.ref_storage_payload);
- the_repository->repository_format_worktree_config =
+ repo->repository_format_worktree_config =
repo_fmt.worktree_config;
- the_repository->repository_format_relative_worktrees =
+ repo->repository_format_relative_worktrees =
repo_fmt.relative_worktrees;
- the_repository->repository_format_submodule_path_cfg =
+ repo->repository_format_submodule_path_cfg =
repo_fmt.submodule_path_cfg;
/* take ownership of repo_fmt.partial_clone */
- the_repository->repository_format_partial_clone =
+ repo->repository_format_partial_clone =
repo_fmt.partial_clone;
repo_fmt.partial_clone = NULL;
- the_repository->repository_format_precious_objects =
+ repo->repository_format_precious_objects =
repo_fmt.precious_objects;
}
}
format = ref_storage_format_by_name(backend);
if (format == REF_STORAGE_FORMAT_UNKNOWN)
die(_("unknown ref storage format: '%s'"), backend);
- repo_set_ref_storage_format(the_repository, format, payload);
+ repo_set_ref_storage_format(repo, format, payload);
free(backend);
free(payload);
}
- setup_original_cwd(the_repository);
+ setup_original_cwd(repo);
strbuf_release(&dir);
strbuf_release(&gitdir);
*/
const char *setup_git_directory(void)
{
- return setup_git_directory_gently(NULL);
+ return setup_git_directory_gently(the_repository, NULL);
}
const char *resolve_gitdir_gently(const char *suspect, int *return_error_code)