sha1_file.c: move delayed getenv(altdb) back to setup_git_env()
[git/git.git] / repository.c
index e65f413..04d85a2 100644 (file)
@@ -60,6 +60,8 @@ void repo_set_gitdir(struct repository *repo,
        repo_set_commondir(repo, o->commondir);
        expand_base_dir(&repo->objectdir, o->object_dir,
                        repo->commondir, "objects");
+       free(repo->alternate_db);
+       repo->alternate_db = xstrdup_or_null(o->alternate_db);
        expand_base_dir(&repo->graft_file, o->graft_file,
                        repo->commondir, "info/grafts");
        expand_base_dir(&repo->index_file, o->index_file,
@@ -215,6 +217,7 @@ void repo_clear(struct repository *repo)
        FREE_AND_NULL(repo->gitdir);
        FREE_AND_NULL(repo->commondir);
        FREE_AND_NULL(repo->objectdir);
+       FREE_AND_NULL(repo->alternate_db);
        FREE_AND_NULL(repo->graft_file);
        FREE_AND_NULL(repo->index_file);
        FREE_AND_NULL(repo->worktree);