Skip to contentSkip to conversation

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

PATCH In review Dmitry Kakurin 2 participants 2 messages Jun 15, 2016

lore
Share & tools
lore
#0 lore raw

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

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.

---
setup.c | 2 +-

1 files changed, 1 insertions(+), 1 deletions(-)
setup.c +1 -1
index e921013..47cd790 100644
@@ -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)
Signature · 1 line
mingw.v1.5.2.4.884.gad85-dirty
#1 lore raw

Hi,

Quoted 2 lines · Dmitry Kakurin

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

Ooops. I think I did not even check that into msysgit.git. Thanks.

Quoted 2 lines

- if (gitdirenv[0] != '/') {
+ if ( !is_absolute_path( gitdirenv ) ) {

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

+ if (!is_absolute_path(gitdirenv)) {

is the way we prefer it.

Ciao,
Dscho