aboutsummaryrefslogtreecommitdiffstats
path: root/setup.c
diff options
context:
space:
mode:
Diffstat (limited to 'setup.c')
-rw-r--r--setup.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/setup.c b/setup.c
index 8a488f3e7c..7da7aa8984 100644
--- a/setup.c
+++ b/setup.c
@@ -2517,7 +2517,9 @@ static void repository_format_configure(struct repository_format *repo_fmt,
int env_algo = hash_algo_by_name(env);
if (env_algo == GIT_HASH_UNKNOWN)
die(_("unknown hash algorithm '%s'"), env);
- repo_fmt->hash_algo = env_algo;
+ if (repo_fmt->version < 0 ||
+ repo_fmt->hash_algo == GIT_HASH_UNKNOWN)
+ repo_fmt->hash_algo = env_algo;
} else if (cfg.hash != GIT_HASH_UNKNOWN) {
repo_fmt->hash_algo = cfg.hash;
}
@@ -2534,7 +2536,9 @@ static void repository_format_configure(struct repository_format *repo_fmt,
ref_format = ref_storage_format_by_name(env);
if (ref_format == REF_STORAGE_FORMAT_UNKNOWN)
die(_("unknown ref storage format '%s'"), env);
- repo_fmt->ref_storage_format = ref_format;
+ if (repo_fmt->version < 0 ||
+ repo_fmt->ref_storage_format == REF_STORAGE_FORMAT_UNKNOWN)
+ repo_fmt->ref_storage_format = ref_format;
} else if (cfg.ref_format != REF_STORAGE_FORMAT_UNKNOWN) {
repo_fmt->ref_storage_format = cfg.ref_format;
}