mirror of
https://github.com/git-for-windows/git.git
synced 2026-06-08 11:51:00 -05:00
setup: stop using the_repository in upgrade_repository_format()
Stop using `the_repository` in `upgrade_repository_format()` 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. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
committed by
Junio C Hamano
parent
f9210dbc8a
commit
9cae7229c9
@@ -378,7 +378,7 @@ void partial_clone_register(
|
||||
*/
|
||||
return;
|
||||
} else {
|
||||
if (upgrade_repository_format(1) < 0)
|
||||
if (upgrade_repository_format(the_repository, 1) < 0)
|
||||
die(_("unable to upgrade repository format to support partial clone"));
|
||||
|
||||
/* Add promisor config for the remote */
|
||||
|
||||
@@ -281,6 +281,6 @@ void repo_update_index_if_able(struct repository *, struct lock_file *);
|
||||
* Return 1 if upgrade repository format to target_version succeeded,
|
||||
* 0 if no upgrade is necessary, and -1 when upgrade is not possible.
|
||||
*/
|
||||
int upgrade_repository_format(int target_version);
|
||||
int upgrade_repository_format(struct repository *repo, int target_version);
|
||||
|
||||
#endif /* REPOSITORY_H */
|
||||
|
||||
6
setup.c
6
setup.c
@@ -811,7 +811,7 @@ static int check_repository_format_gently(struct repository *repo,
|
||||
return 0;
|
||||
}
|
||||
|
||||
int upgrade_repository_format(int target_version)
|
||||
int upgrade_repository_format(struct repository *repo, int target_version)
|
||||
{
|
||||
struct strbuf sb = STRBUF_INIT;
|
||||
struct strbuf err = STRBUF_INIT;
|
||||
@@ -819,7 +819,7 @@ int upgrade_repository_format(int target_version)
|
||||
struct repository_format repo_fmt = REPOSITORY_FORMAT_INIT;
|
||||
int ret;
|
||||
|
||||
repo_common_path_append(the_repository, &sb, "config");
|
||||
repo_common_path_append(repo, &sb, "config");
|
||||
read_repository_format(&repo_fmt, sb.buf);
|
||||
strbuf_release(&sb);
|
||||
|
||||
@@ -841,7 +841,7 @@ int upgrade_repository_format(int target_version)
|
||||
}
|
||||
|
||||
strbuf_addf(&repo_version, "%d", target_version);
|
||||
repo_config_set(the_repository, "core.repositoryformatversion", repo_version.buf);
|
||||
repo_config_set(repo, "core.repositoryformatversion", repo_version.buf);
|
||||
|
||||
ret = 1;
|
||||
|
||||
|
||||
@@ -1104,7 +1104,7 @@ void write_worktree_linking_files(const char *dotgit, const char *gitdir,
|
||||
strbuf_realpath(&repo, repo.buf, 1);
|
||||
|
||||
if (use_relative_paths && !the_repository->repository_format_relative_worktrees) {
|
||||
if (upgrade_repository_format(1) < 0)
|
||||
if (upgrade_repository_format(the_repository, 1) < 0)
|
||||
die(_("unable to upgrade repository format to support relative worktrees"));
|
||||
if (repo_config_set_gently(the_repository, "extensions.relativeWorktrees", "true"))
|
||||
die(_("unable to set extensions.relativeWorktrees setting"));
|
||||
|
||||
Reference in New Issue
Block a user