/* The main repository */
static struct repository the_repo = {
- NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, &the_index, 0, 0
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, &the_index, NULL, 0, 0
};
struct repository *the_repository = &the_repo;
free(old_gitdir);
}
+void repo_set_hash_algo(struct repository *repo, int hash_algo)
+{
+ repo->hash_algo = &hash_algos[hash_algo];
+}
+
/*
* Attempt to resolve and set the provided 'gitdir' for repository 'repo'.
* Return 0 upon success and a non-zero value upon failure.
if (read_and_verify_repository_format(&format, repo->commondir))
goto error;
+ repo_set_hash_algo(repo, format.hash_algo);
+
if (worktree)
repo_set_worktree(repo, worktree);