From 9b9784cab9bba925ab35c7aa8d4e5967a4268093 Mon Sep 17 00:00:00 2001 From: Pat Thoyts Date: Wed, 17 Mar 2010 15:17:34 +0000 Subject: MinGW: fix stat() and lstat() implementations for handling symlinks In msysGit the stat() function has been implemented using mingw_lstat which sets the st_mode member to S_IFLNK when a symbolic links is found. This causes the is_executable function to return when git attempts to build a list of available commands in the help code and we end up missing most git commands. (msysGit issue #445) This patch modifies the implementation so that lstat() will return the link flag but if we are called as stat() we read the size of the target and set the mode to that of a regular file. Includes squashed fix st_mode for symlink dirs Signed-off-by: Pat Thoyts Signed-off-by: Erik Faye-Lund --- compat/mingw.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'compat/mingw.h') diff --git a/compat/mingw.h b/compat/mingw.h index 74c799ad38..47839663be 100644 --- a/compat/mingw.h +++ b/compat/mingw.h @@ -235,10 +235,11 @@ int mingw_getpagesize(void); #ifndef ALREADY_DECLARED_STAT_FUNCS #define stat _stati64 int mingw_lstat(const char *file_name, struct stat *buf); +int mingw_stat(const char *file_name, struct stat *buf); int mingw_fstat(int fd, struct stat *buf); #define fstat mingw_fstat #define lstat mingw_lstat -#define _stati64(x,y) mingw_lstat(x,y) +#define _stati64(x,y) mingw_stat(x,y) #endif int mingw_utime(const char *file_name, const struct utimbuf *times); -- cgit v1.2.1