mirror of
https://github.com/git/git.git
synced 2026-03-13 18:33:25 +01:00
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 <Dmitry.Kakurin@gmail.com> Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
This commit is contained in:
committed by
Johannes Schindelin
parent
ef5af72062
commit
4a66a6c4c2
2
setup.c
2
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)
|
||||
|
||||
Reference in New Issue
Block a user