All of lore.kernel.org
 help / color / mirror / Atom feed
* Re: [PATCH] On Cygwin support both UNIX and DOS style path-names
@ 2011-07-27 15:57 Theo Niessink
  2011-07-28  9:28 ` Pascal Obry
  0 siblings, 1 reply; 4+ messages in thread
From: Theo Niessink @ 2011-07-27 15:57 UTC (permalink / raw)
  To: git, pascal

Pascal Obry wrote:
> In fact Cygwin supports both, so make Git agree with this.

Why not indeed, especially since both are already supported under MinGW.

> +#define has_dos_drive_prefix(path) (isalpha(*(path)) && (path)[1] == ':')
> +#define is_dir_sep(c) ((c) == '/' || (c) == '\\')

I think that by defining is_dir_sep you enable DOS/Windows style paths
throughout Git, so you might want to check compat/mingw.h for other, related
changes. You will probably at least want the MinGW version of
find_last_dir_sep as well, because the default find_last_dir_sep doesn't use
is_dir_sep.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] On Cygwin support both UNIX and DOS style path-names
  2011-07-27 15:57 [PATCH] On Cygwin support both UNIX and DOS style path-names Theo Niessink
@ 2011-07-28  9:28 ` Pascal Obry
  2011-07-28 10:44   ` Theo Niessink
  0 siblings, 1 reply; 4+ messages in thread
From: Pascal Obry @ 2011-07-28  9:28 UTC (permalink / raw)
  To: Theo Niessink; +Cc: git


Theo,

>> +#define has_dos_drive_prefix(path) (isalpha(*(path))&&  (path)[1] == ':')
>> +#define is_dir_sep(c) ((c) == '/' || (c) == '\\')
>
> I think that by defining is_dir_sep you enable DOS/Windows style paths
> throughout Git, so you might want to check compat/mingw.h for other, related
> changes. You will probably at least want the MinGW version of
> find_last_dir_sep as well, because the default find_last_dir_sep doesn't use
> is_dir_sep.

Thanks for the review/feedback. Will work on that and propose another patch.

Pascal.

-- 

--|------------------------------------------------------
--| Pascal Obry                           Team-Ada Member
--| 45, rue Gabriel Peri - 78114 Magny Les Hameaux FRANCE
--|------------------------------------------------------
--|    http://www.obry.net  -  http://v2p.fr.eu.org
--| "The best way to travel is by means of imagination"
--|
--| gpg --keyserver keys.gnupg.net --recv-key F949BD3B

^ permalink raw reply	[flat|nested] 4+ messages in thread

* RE: [PATCH] On Cygwin support both UNIX and DOS style path-names
  2011-07-28  9:28 ` Pascal Obry
@ 2011-07-28 10:44   ` Theo Niessink
  0 siblings, 0 replies; 4+ messages in thread
From: Theo Niessink @ 2011-07-28 10:44 UTC (permalink / raw)
  To: pascal; +Cc: git

Pascal Obry wrote:
> Thanks for the review/feedback. Will work on that and propose another
> patch.

Perhaps something like this on top of (or before) your patch?

-- >8 --
Subject: [PATCH] git-compat-util: add generic find_last_dir_sep that respects
 is_dir_sep

Move MinGW's find_last_dir_sep to git-compat-util.h, so it can also be used
on other platforms that define is_dir_sep, e.g. Cygwin.

Signed-off-by: Theo Niessink <theo@taletn.com>
---
 compat/mingw.h    |    9 ---------
 git-compat-util.h |   12 ++++++++++++
 2 files changed, 12 insertions(+), 9 deletions(-)

diff --git a/compat/mingw.h b/compat/mingw.h
index ce9dd98..547568b 100644
--- a/compat/mingw.h
+++ b/compat/mingw.h
@@ -300,15 +300,6 @@ int winansi_fprintf(FILE *stream, const char *format, ...) __attribute__((format
 
 #define has_dos_drive_prefix(path) (isalpha(*(path)) && (path)[1] == ':')
 #define is_dir_sep(c) ((c) == '/' || (c) == '\\')
-static inline char *mingw_find_last_dir_sep(const char *path)
-{
-	char *ret = NULL;
-	for (; *path; ++path)
-		if (is_dir_sep(*path))
-			ret = (char *)path;
-	return ret;
-}
-#define find_last_dir_sep mingw_find_last_dir_sep
 #define PATH_SEP ';'
 #define PRIuMAX "I64u"
 
diff --git a/git-compat-util.h b/git-compat-util.h
index ddfbf77..c2c94cd 100644
--- a/git-compat-util.h
+++ b/git-compat-util.h
@@ -211,6 +211,18 @@ extern char *gitbasename(char *);
 #define has_dos_drive_prefix(path) 0
 #endif
 
+#if !defined(find_last_dir_sep) && defined(is_dir_sep)
+static inline char *compat_find_last_dir_sep(const char *path)
+{
+	char *ret = NULL;
+	for (; *path; ++path)
+		if (is_dir_sep(*path))
+			ret = (char *)path;
+	return ret;
+}
+#define find_last_dir_sep compat_find_last_dir_sep
+#endif
+
 #ifndef is_dir_sep
 #define is_dir_sep(c) ((c) == '/')
 #endif
-- 
1.7.6.msysgit.0

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH] On Cygwin support both UNIX and DOS style path-names
@ 2011-07-25 17:27 Pascal Obry
  0 siblings, 0 replies; 4+ messages in thread
From: Pascal Obry @ 2011-07-25 17:27 UTC (permalink / raw)
  To: git; +Cc: Pascal Obry

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@obry.net>
---
 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) == '\\')
-- 
1.7.6.345.g5c2f8

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2011-07-28 10:44 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-07-27 15:57 [PATCH] On Cygwin support both UNIX and DOS style path-names Theo Niessink
2011-07-28  9:28 ` Pascal Obry
2011-07-28 10:44   ` Theo Niessink
  -- strict thread matches above, loose matches on Subject: below --
2011-07-25 17:27 Pascal Obry

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.