[MinGW PATCH] 'git clone git://...' was failing inside git-read-tree with 'fatal: Not a valid object name HEAD'

Previous thread: Terminology question about remote branches. by David Kastrup on Saturday, August 4, 2007 - 6:55 am. (36 messages)

Next thread: Re: Terminology question about remote branches. by Jakub Narebski on Saturday, August 4, 2007 - 8:14 am. (1 message)
To: <git@...>
Cc: Johannes Schindelin <Johannes.Schindelin@...>, <johannes.sixt@...>
Date: Saturday, August 4, 2007 - 7:38 am

NOTE: This fix uses is_absolute_path from msysGit-0.3.exe that is not in mingw.git yet.

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>
---
setup.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/setup.c b/setup.c
index e921013..47cd790 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)
--
mingw.v1.5.2.4.884.gad85-dirty

-

To: Dmitry Kakurin <dmitry.kakurin@...>
Cc: <johannes.sixt@...>, <git@...>
Date: Saturday, August 4, 2007 - 10:16 am

Hi,

Our coding style does not want them extra spaces...

+ if (!is_absolute_path(gitdirenv)) {

is the way we prefer it.

Ciao,
Dscho

-

Previous thread: Terminology question about remote branches. by David Kastrup on Saturday, August 4, 2007 - 6:55 am. (36 messages)

Next thread: Re: Terminology question about remote branches. by Jakub Narebski on Saturday, August 4, 2007 - 8:14 am. (1 message)