init-db: move writing repo version into a function

When we perform a clone, we won't know the remote side's hash algorithm
until we've read the heads.  Consequently, we'll need to rewrite the
repository format version and hash algorithm once we know what the
remote side has.  Move the code that does this into its own function so
that we can call it from clone in the future.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
brian m. carlson
2020-02-22 20:17:40 +00:00
committed by Junio C Hamano
parent 3c9331a129
commit efa7ae36c1
2 changed files with 25 additions and 18 deletions

View File

@ -629,6 +629,7 @@ int path_inside_repo(const char *prefix, const char *path);
int init_db(const char *git_dir, const char *real_git_dir,
const char *template_dir, int hash_algo,
unsigned int flags);
void initialize_repository_version(int hash_algo);
void sanitize_stdfds(void);
int daemonize(void);