Pascal Obry <pascal@xxxxxxxx> writes: > In fact Cygwin supports both, so make Git agree with this. > The failing case is when a file is committed in a sub-dir of the > repository using a log message from a file specified with a DOS > style path-name. To reproduce: > > $ cd src > $ git commit -F c:\tmp\log.txt file.c > fatal: could not read log file 'src/c:\tmp\log.txt': No such file \ > or directory. > > Signed-off-by: Pascal Obry <pascal@xxxxxxxx> > --- > compat/cygwin.h | 3 +++ > 1 files changed, 3 insertions(+), 0 deletions(-) > > diff --git a/compat/cygwin.h b/compat/cygwin.h > index a3229f5..de9737c 100644 > --- a/compat/cygwin.h > +++ b/compat/cygwin.h > @@ -7,3 +7,6 @@ extern stat_fn_t cygwin_lstat_fn; > > #define stat(path, buf) (*cygwin_stat_fn)(path, buf) > #define lstat(path, buf) (*cygwin_lstat_fn)(path, buf) > + > +#define has_dos_drive_prefix(path) (isalpha(*(path)) && (path)[1] == ':') > +#define is_dir_sep(c) ((c) == '/' || (c) == '\\') I wonder if these two that are the same as mingw should further be consolidated into one implementation, something like below. Note that I am just wondering, not suggesting, without knowing which is better. compat/cygwin.h | 5 ++--- compat/mingw.h | 3 +-- git-compat-util.h | 11 ++++------- 3 files changed, 7 insertions(+), 12 deletions(-) diff --git a/compat/cygwin.h b/compat/cygwin.h index de9737c..ef0889b 100644 --- a/compat/cygwin.h +++ b/compat/cygwin.h @@ -1,12 +1,11 @@ #include <sys/types.h> #include <sys/stat.h> +#define DOS_STYLE_DIR_SEP 1 + typedef int (*stat_fn_t)(const char*, struct stat*); extern stat_fn_t cygwin_stat_fn; extern stat_fn_t cygwin_lstat_fn; #define stat(path, buf) (*cygwin_stat_fn)(path, buf) #define lstat(path, buf) (*cygwin_lstat_fn)(path, buf) - -#define has_dos_drive_prefix(path) (isalpha(*(path)) && (path)[1] == ':') -#define is_dir_sep(c) ((c) == '/' || (c) == '\\') diff --git a/compat/mingw.h b/compat/mingw.h index 547568b..26ca0ef 100644 --- a/compat/mingw.h +++ b/compat/mingw.h @@ -298,8 +298,7 @@ int winansi_fprintf(FILE *stream, const char *format, ...) __attribute__((format * git specific compatibility */ -#define has_dos_drive_prefix(path) (isalpha(*(path)) && (path)[1] == ':') -#define is_dir_sep(c) ((c) == '/' || (c) == '\\') +#define DOS_STYLE_DIR_SEP 1 #define PATH_SEP ';' #define PRIuMAX "I64u" diff --git a/git-compat-util.h b/git-compat-util.h index c2c94cd..133f331 100644 --- a/git-compat-util.h +++ b/git-compat-util.h @@ -211,7 +211,9 @@ extern char *gitbasename(char *); #define has_dos_drive_prefix(path) 0 #endif -#if !defined(find_last_dir_sep) && defined(is_dir_sep) +#if defined(DOS_STYLE_DIR_SEP) +#define has_dos_drive_prefix(path) (isalpha(*(path)) && (path)[1] == ':') +#define is_dir_sep(c) ((c) == '/' || (c) == '\\') static inline char *compat_find_last_dir_sep(const char *path) { char *ret = NULL; @@ -221,13 +223,8 @@ static inline char *compat_find_last_dir_sep(const char *path) return ret; } #define find_last_dir_sep compat_find_last_dir_sep -#endif - -#ifndef is_dir_sep +#else #define is_dir_sep(c) ((c) == '/') -#endif - -#ifndef find_last_dir_sep #define find_last_dir_sep(path) strrchr(path, '/') #endif -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html