{"thread":{"id":"27935","subject":"Re: [PATCH] On Cygwin support both UNIX and DOS style path-names","startedAt":"2011-07-27T15:57:04Z","lastAt":"2011-07-28T10:44:45Z","messageCount":3,"participants":["Theo Niessink","Pascal Obry"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"172174","messageId":"FD5C22CB4AC2439D8151F6B7CD4B7CC9@martinic.local","threadId":"27935","inReplyTo":null,"subject":"Re: [PATCH] On Cygwin support both UNIX and DOS style path-names","fromName":"Theo Niessink","fromEmail":"theo@taletn.com","sentAt":"2011-07-27T15:57:04Z","receivedAt":"2011-07-27T15:57:04Z","isPatch":true,"sender":{"key":"theo@taletn.com","avatar":"https://avatars.githubusercontent.com/u/5729397?v=4"},"body":"Pascal Obry wrote:\n> In fact Cygwin supports both, so make Git agree with this.\n\nWhy not indeed, especially since both are already supported under MinGW.\n\n> +#define has_dos_drive_prefix(path) (isalpha(*(path)) && (path)[1] == ':')\n> +#define is_dir_sep(c) ((c) == '/' || (c) == '\\\\')\n\nI think that by defining is_dir_sep you enable DOS/Windows style paths\nthroughout Git, so you might want to check compat/mingw.h for other, related\nchanges. You will probably at least want the MinGW version of\nfind_last_dir_sep as well, because the default find_last_dir_sep doesn't use\nis_dir_sep.\n"},{"id":"172245","messageId":"4E312BD6.6020901@obry.net","threadId":"27935","inReplyTo":"FD5C22CB4AC2439D8151F6B7CD4B7CC9@martinic.local","subject":"Re: [PATCH] On Cygwin support both UNIX and DOS style path-names","fromName":"Pascal Obry","fromEmail":"pascal@obry.net","sentAt":"2011-07-28T09:28:54Z","receivedAt":"2011-07-28T09:28:54Z","isPatch":true,"sender":{"key":"pascal@obry.net","avatar":"https://avatars.githubusercontent.com/u/467069?v=4"},"body":"\nTheo,\n\n>> +#define has_dos_drive_prefix(path) (isalpha(*(path))&&  (path)[1] == ':')\n>> +#define is_dir_sep(c) ((c) == '/' || (c) == '\\\\')\n>\n> I think that by defining is_dir_sep you enable DOS/Windows style paths\n> throughout Git, so you might want to check compat/mingw.h for other, related\n> changes. You will probably at least want the MinGW version of\n> find_last_dir_sep as well, because the default find_last_dir_sep doesn't use\n> is_dir_sep.\n\nThanks for the review/feedback. Will work on that and propose another patch.\n\nPascal.\n\n-- \n\n--|------------------------------------------------------\n--| Pascal Obry                           Team-Ada Member\n--| 45, rue Gabriel Peri - 78114 Magny Les Hameaux FRANCE\n--|------------------------------------------------------\n--|    http://www.obry.net  -  http://v2p.fr.eu.org\n--| \"The best way to travel is by means of imagination\"\n--|\n--| gpg --keyserver keys.gnupg.net --recv-key F949BD3B\n"},{"id":"172255","messageId":"214795D425BD400EB32D9D140BB8C1F6@martinic.local","threadId":"27935","inReplyTo":"4E312BD6.6020901@obry.net","subject":"RE: [PATCH] On Cygwin support both UNIX and DOS style path-names","fromName":"Theo Niessink","fromEmail":"theo@taletn.com","sentAt":"2011-07-28T10:44:45Z","receivedAt":"2011-07-28T10:44:45Z","isPatch":true,"sender":{"key":"theo@taletn.com","avatar":"https://avatars.githubusercontent.com/u/5729397?v=4"},"body":"Pascal Obry wrote:\n> Thanks for the review/feedback. Will work on that and propose another\n> patch.\n\nPerhaps something like this on top of (or before) your patch?\n\n-- >8 --\nSubject: [PATCH] git-compat-util: add generic find_last_dir_sep that respects\n is_dir_sep\n\nMove MinGW's find_last_dir_sep to git-compat-util.h, so it can also be used\non other platforms that define is_dir_sep, e.g. Cygwin.\n\nSigned-off-by: Theo Niessink <theo@taletn.com>\n---\n compat/mingw.h    |    9 ---------\n git-compat-util.h |   12 ++++++++++++\n 2 files changed, 12 insertions(+), 9 deletions(-)\n\ndiff --git a/compat/mingw.h b/compat/mingw.h\nindex ce9dd98..547568b 100644\n--- a/compat/mingw.h\n+++ b/compat/mingw.h\n@@ -300,15 +300,6 @@ int winansi_fprintf(FILE *stream, const char *format, ...) __attribute__((format\n \n #define has_dos_drive_prefix(path) (isalpha(*(path)) && (path)[1] == ':')\n #define is_dir_sep(c) ((c) == '/' || (c) == '\\\\')\n-static inline char *mingw_find_last_dir_sep(const char *path)\n-{\n-\tchar *ret = NULL;\n-\tfor (; *path; ++path)\n-\t\tif (is_dir_sep(*path))\n-\t\t\tret = (char *)path;\n-\treturn ret;\n-}\n-#define find_last_dir_sep mingw_find_last_dir_sep\n #define PATH_SEP ';'\n #define PRIuMAX \"I64u\"\n \ndiff --git a/git-compat-util.h b/git-compat-util.h\nindex ddfbf77..c2c94cd 100644\n--- a/git-compat-util.h\n+++ b/git-compat-util.h\n@@ -211,6 +211,18 @@ extern char *gitbasename(char *);\n #define has_dos_drive_prefix(path) 0\n #endif\n \n+#if !defined(find_last_dir_sep) && defined(is_dir_sep)\n+static inline char *compat_find_last_dir_sep(const char *path)\n+{\n+\tchar *ret = NULL;\n+\tfor (; *path; ++path)\n+\t\tif (is_dir_sep(*path))\n+\t\t\tret = (char *)path;\n+\treturn ret;\n+}\n+#define find_last_dir_sep compat_find_last_dir_sep\n+#endif\n+\n #ifndef is_dir_sep\n #define is_dir_sep(c) ((c) == '/')\n #endif\n-- \n1.7.6.msysgit.0\n"}]}