@@ -361,7 +361,7 @@ static int set_config(enum sparse_checkout_mode mode)
{
const char *config_path;
- if (upgrade_repository_format(1) < 0)
+ if (upgrade_repository_format(the_repository, 1) < 0)
die(_("unable to upgrade repository format to enable worktreeConfig"));
if (git_config_set_gently("extensions.worktreeConfig", "true")) {
error(_("failed to set extensions.worktreeConfig setting"));
@@ -372,7 +372,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 */
@@ -215,6 +215,6 @@ void prepare_repo_settings(struct repository *r);
* 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 *, int target_version);
#endif /* REPOSITORY_H */
@@ -595,14 +595,14 @@ static int check_repository_format_gently(const char *gitdir, struct repository_
return 0;
}
-int upgrade_repository_format(int target_version)
+int upgrade_repository_format(struct repository *r, int target_version)
{
struct strbuf sb = STRBUF_INIT;
struct strbuf err = STRBUF_INIT;
struct strbuf repo_version = STRBUF_INIT;
struct repository_format repo_fmt = REPOSITORY_FORMAT_INIT;
- strbuf_git_common_path(&sb, the_repository, "config");
+ strbuf_git_common_path(&sb, r, "config");
read_repository_format(&repo_fmt, sb.buf);
strbuf_release(&sb);
@@ -621,7 +621,7 @@ int upgrade_repository_format(int target_version)
repo_fmt.unknown_extensions.items[0].string);
strbuf_addf(&repo_version, "%d", target_version);
- git_config_set("core.repositoryformatversion", repo_version.buf);
+ repo_config_set(r, "core.repositoryformatversion", repo_version.buf);
strbuf_release(&repo_version);
return 1;
}