Re: [PATCH v3 2/3] relative_path should honor DOS and UNC paths

2013-09-18 Thread Junio C Hamano
Jiang Xin writes: > 2013/9/18 Junio C Hamano : >>> + if (!is_dir_sep(*path) || !is_dir_sep(*(path+1)) || >>> is_dir_sep(*(path+2))) >>> + return 0; >> If path[1] == '\0', it would be !is_dir_sep() and we end up >> inspecting past the end of the string? > > The funciton "is_unc_pa

Re: [PATCH v3 2/3] relative_path should honor DOS and UNC paths

2013-09-18 Thread Torsten Bögershausen
On 2013-09-18 16.37, Torsten Bögershausen wrote: > On 2013-09-17 18.12, Junio C Hamano wrote: >> Jiang Xin writes: >> >>> diff --git a/compat/mingw.h b/compat/mingw.h >>> index bd0a88b..06e9f49 100644 >>> --- a/compat/mingw.h >>> +++ b/compat/mingw.h >>> @@ -311,6 +311,15 @@ int winansi_fprintf(FI

Re: [PATCH v3 2/3] relative_path should honor DOS and UNC paths

2013-09-18 Thread Jiang Xin
2013/9/18 Junio C Hamano : > Jiang Xin writes: > >> diff --git a/compat/mingw.h b/compat/mingw.h >> index bd0a88b..06e9f49 100644 >> --- a/compat/mingw.h >> +++ b/compat/mingw.h >> @@ -311,6 +311,15 @@ int winansi_fprintf(FILE *stream, const char *format, >> ...) __attribute__((format >> >> #def

Re: [PATCH v3 2/3] relative_path should honor DOS and UNC paths

2013-09-17 Thread Junio C Hamano
Jiang Xin writes: > diff --git a/compat/mingw.h b/compat/mingw.h > index bd0a88b..06e9f49 100644 > --- a/compat/mingw.h > +++ b/compat/mingw.h > @@ -311,6 +311,15 @@ int winansi_fprintf(FILE *stream, const char *format, > ...) __attribute__((format > > #define has_dos_drive_prefix(path) (isal

[PATCH v3 2/3] relative_path should honor DOS and UNC paths

2013-09-17 Thread Jiang Xin
Tvangeste found that the "relative_path" function could not work properly on Windows if "in" and "prefix" have DOS driver prefix (such as "C:/windows"). And the "relative_path" function won't work properly if either "in" or "prefix" is a UNC path (like "//host/share"). ($gmane/234434) E.g., When e