From 4a66a6c4c236827c3ea89c75f908bf8019b3758c Mon Sep 17 00:00:00 2001 From: Dmitry Kakurin Date: Sat, 4 Aug 2007 04:38:13 -0700 Subject: [PATCH] Correctly test for absolute path This fix (while correct) actually avoids another nasty bug that must be fixed later: 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. Signed-off-by: Dmitry Kakurin Signed-off-by: Johannes Schindelin --- setup.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.c b/setup.c index e921013926..4d14541bcc 100644 --- a/setup.c +++ b/setup.c @@ -332,7 +332,7 @@ const char *setup_git_directory_gently(int *nongit_ok) * In case there is a work tree we may change the directory, * therefore make GIT_DIR an absolute path. */ - if (gitdirenv[0] != '/') { + if (!is_absolute_path(gitdirenv)) { setenv(GIT_DIR_ENVIRONMENT, gitdir, 1); gitdirenv = getenv(GIT_DIR_ENVIRONMENT); if (!gitdirenv)