sha1_file.c: move delayed getenv(altdb) back to setup_git_env()

getenv() is supposed to work on the main repository only. This delayed
getenv() code in sha1_file.c makes it more difficult to convert
sha1_file.c to a generic object store that could be used by both
submodule and main repositories.

Move the getenv() back in setup_git_env() where other env vars are
also fetched.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Nguyễn Thái Ngọc Duy
2018-03-03 18:35:57 +07:00
committed by Junio C Hamano
parent 0ac5af5995
commit 7bc0dcaa61
4 changed files with 9 additions and 5 deletions

View File

@ -667,15 +667,11 @@ int foreach_alt_odb(alt_odb_fn fn, void *cb)
void prepare_alt_odb(void)
{
const char *alt;
if (alt_odb_tail)
return;
alt = getenv(ALTERNATE_DB_ENVIRONMENT);
alt_odb_tail = &alt_odb_list;
link_alt_odb_entries(alt, PATH_SEP, NULL, 0);
link_alt_odb_entries(the_repository->alternate_db, PATH_SEP, NULL, 0);
read_info_alternates(get_object_directory(), 0);
}