threads / patch / 9348

patchFixed error 'fatal: Not a git repository' on Vista

Subject: [MinGW PATCH] Fixed error 'fatal: Not a git repository' on Vista

## tl;dr

4 messages between Aug 2, 2007 and Aug 16, 2007. Diffs are folded; open one to read it.

replies: 3people: 4as markdown or json

Dmitry Kakurin· Aug 2, 2007, 05:47 UTC · lore

Any git command was immediately failing on Vista under MinGW with fatal: Not a git repository

>From 51d66fbfe3a7876d9a7b699bb47c0ab186ddc7a2 Mon Sep 17 00:00:00 2001
From: Dmitry Kakurin <Dmitry.Kakurin@gmail.com>
Date: Wed, 1 Aug 2007 22:30:43 -0700
Subject: [PATCH] Fixed error 'fatal: Not a git repository' on Vista
Defined __USE_MINGW_ACCESS that changes access( ..., X_OK ) into F_OK
Signed-off-by: Dmitry Kakurin <Dmitry.Kakurin@gmail.com>
---
 Makefile |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
Show changes to Makefile +3 −1
diff --git a/Makefile b/Makefile
index 8e9a76b..ef40267 100644
--- a/Makefile
+++ b/Makefile
@@ -500,7 +500,7 @@ ifneq (,$(findstring MINGW,$(uname_S)))
  NO_SYMLINKS=YesPlease
  NO_SVN_TESTS=YesPlease
  NO_PERL_MAKEMAKER=YesPlease
- COMPAT_CFLAGS 
+= -DNO_ETC_PASSWD -DNO_ST_BLOCKS -DSTRIP_EXTENSION=\".exe\" -I compat
+ COMPAT_CFLAGS 
+= -DNO_ETC_PASSWD -DNO_ST_BLOCKS -DSTRIP_EXTENSION=\".exe\" -D__USE_MINGW_ACCESS 
 -I compat
  COMPAT_OBJS += compat/mingw.o compat/fnmatch.o compat/regex.o
  EXTLIBS += -lws2_32
  X = .exe
-- 
1.5.2.2
Johannes Schindelin· Aug 2, 2007, 10:33 UTC · re: Dmitry Kakurin · lore

Re: [MinGW PATCH] Fixed error 'fatal: Not a git repository' on Vista

Hi,

[please consider reading Documentation/SubmittingPatches; you did not Cc: the maintainer, Johannes Sixt]

On Wed, 1 Aug 2007, Dmitry Kakurin wrote:
> Any git command was immediately failing on Vista under MinGW with
> fatal: Not a git repository

Thanks for submitting this patch. I cannot test personally, because nobody I know has Vista.

I guess that Hannes will apply your patch when he comes back from his well-deserved holiday.

You might want to consider pushing your changes to the mob branch on repo.or.cz/git/mingw.git.

>From your mail, I take it that the .zip file I sent you is working 
properly?

Ciao, Dscho

Johannes Sixt· Aug 16, 2007, 08:37 UTC · re: Dmitry Kakurin · lore

Re: [MinGW PATCH] Fixed error 'fatal: Not a git repository' on Vista

Dmitry Kakurin wrote:
> - COMPAT_CFLAGS
> += -DNO_ETC_PASSWD -DNO_ST_BLOCKS -DSTRIP_EXTENSION=\".exe\" -I compat
> + COMPAT_CFLAGS
> += -DNO_ETC_PASSWD -DNO_ST_BLOCKS -DSTRIP_EXTENSION=\".exe\" -D__USE_MINGW_ACCESS

I don't see how this could make a difference: __USE_MINGW_ACCESS appears in none of the mingw header files nor in the mingw.git sources.

Is my build environment outdated?
-- Hannes
Marco Roeland· Aug 16, 2007, 09:56 UTC · re: Johannes Sixt · lore

Re: [MinGW PATCH] Fixed error 'fatal: Not a git repository' on Vista

On Thursday August 16th 2007 at 10:37 Johannes Sixt wrote:
> I don't see how this could make a difference: __USE_MINGW_ACCESS appears
> in none of the mingw header files nor in the mingw.git sources.
> 
> Is my build environment outdated?

The mingw patch for fixing this Vista regression (from Danny Smith on March 5th) is in mingw-runtime-3.12-1. It is in file <include/io.h> and works like this:

#ifdef __USE_MINGW_ACCESS
/*  Old versions of MSVCRT access() just ignored X_OK, while the version
    shipped with Vista, returns an error code.  This will restore the
    old behaviour  */
static inline int __mingw_access (const char* __fname, int __mode)
  { return  _access (__fname, __mode & ~X_OK); }
#define access(__f,__m)  __mingw_access (__f, __m)
#endif

Whenever the X_OK bit is set in the mode flag for access(2) Vista returns an error for the call. So yes, using __USE_MINGW_ACCESS will not work on older mingw versions. Defining X_OK to 0 for mingw might fix the problem for older versions.

-- 
Marco Roeland

← back to recent threads