git clone was failing with 'invalid object name HEAD' if ran from cmd.exe directly

environment.c caches results of many getenv calls.
Under MinGW setenv(X) invalidates all previous values returned by getenv(X)
so cached values become dangling pointers.

Replaced all setenv(GIT_DIR, ...) with set_git_dir

Signed-off-by: Dmitry Kakurin <Dmitry.Kakurin@gmail.com>
This commit is contained in:
Dmitry Kakurin
2007-08-09 13:41:02 -07:00
parent dfcdb3d9fc
commit 855f254b2b
4 changed files with 6 additions and 8 deletions

2
path.c
View File

@@ -265,7 +265,7 @@ char *enter_repo(char *path, int strict)
if (access("objects", X_OK) == 0 && access("refs", X_OK) == 0 &&
validate_headref("HEAD") == 0) {
setenv(GIT_DIR_ENVIRONMENT, ".", 1);
set_git_dir(".");
check_repository_format();
return path;
}