git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATH 0/2] On Cygwin support both UNIX and DOS style path-names
@ 2011-08-05 16:10 Pascal Obry
  2011-08-05 16:10 ` [PATCH 1/2] git-compat-util: add generic find_last_dir_sep that respects is_dir_sep Pascal Obry
  2011-08-05 16:10 ` [PATCH 2/2] On Cygwin support both UNIX and DOS style path-names Pascal Obry
  0 siblings, 2 replies; 19+ messages in thread
From: Pascal Obry @ 2011-08-05 16:10 UTC (permalink / raw)
  To: git

This is the second version of this serie after Theo review. It includes
the patch from Theo first and mine after.

Let me know if it looks ok. Thanks.

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

* [PATCH 1/2] git-compat-util: add generic find_last_dir_sep that respects is_dir_sep
  2011-08-05 16:10 [PATH 0/2] On Cygwin support both UNIX and DOS style path-names Pascal Obry
@ 2011-08-05 16:10 ` Pascal Obry
  2011-08-05 16:10 ` [PATCH 2/2] On Cygwin support both UNIX and DOS style path-names Pascal Obry
  1 sibling, 0 replies; 19+ messages in thread
From: Pascal Obry @ 2011-08-05 16:10 UTC (permalink / raw)
  To: git; +Cc: Theo Niessink

From: Theo Niessink <theo@taletn.com>

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>
Acked-by: Pascal Obry <pascal@obry.net>
---
 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.404.g5d2fc

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

* [PATCH 2/2] On Cygwin support both UNIX and DOS style path-names
  2011-08-05 16:10 [PATH 0/2] On Cygwin support both UNIX and DOS style path-names Pascal Obry
  2011-08-05 16:10 ` [PATCH 1/2] git-compat-util: add generic find_last_dir_sep that respects is_dir_sep Pascal Obry
@ 2011-08-05 16:10 ` Pascal Obry
  2011-08-05 17:29   ` Erik Faye-Lund
                     ` (3 more replies)
  1 sibling, 4 replies; 19+ messages in thread
From: Pascal Obry @ 2011-08-05 16:10 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.404.g5d2fc

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

* Re: [PATCH 2/2] On Cygwin support both UNIX and DOS style path-names
  2011-08-05 16:10 ` [PATCH 2/2] On Cygwin support both UNIX and DOS style path-names Pascal Obry
@ 2011-08-05 17:29   ` Erik Faye-Lund
  2011-08-05 17:35     ` Pascal Obry
  2011-08-09 17:26     ` Ramsay Jones
  2011-08-05 17:48   ` Junio C Hamano
                     ` (2 subsequent siblings)
  3 siblings, 2 replies; 19+ messages in thread
From: Erik Faye-Lund @ 2011-08-05 17:29 UTC (permalink / raw)
  To: Pascal Obry; +Cc: git

On Fri, Aug 5, 2011 at 6:10 PM, Pascal Obry <pascal@obry.net> wrote:
> 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.

Cygwin is a unix-layer on top of Windows, designed to play by the
POSIX-rules. So why would you want to support Windows-style paths on
Cygwin?

If you want a Git that handles Windows paths, use Git for Windows...

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

* Re: [PATCH 2/2] On Cygwin support both UNIX and DOS style path-names
  2011-08-05 17:29   ` Erik Faye-Lund
@ 2011-08-05 17:35     ` Pascal Obry
  2011-08-05 17:39       ` Erik Faye-Lund
  2011-08-09 17:30       ` Ramsay Jones
  2011-08-09 17:26     ` Ramsay Jones
  1 sibling, 2 replies; 19+ messages in thread
From: Pascal Obry @ 2011-08-05 17:35 UTC (permalink / raw)
  To: kusmabite; +Cc: git

Le 05/08/2011 19:29, Erik Faye-Lund a écrit :
> Cygwin is a unix-layer on top of Windows, designed to play by the
> POSIX-rules. So why would you want to support Windows-style paths on
> Cygwin?

Because cygwin toolset does support \.

> If you want a Git that handles Windows paths, use Git for Windows...

Note that Windows is a special case as even the Win32 API does support \ 
and /, so every tool on Windows seems to handle nicely this. Why not 
Git, be it Cygwin/Git. If it does not break anything else.

-- 

--|------------------------------------------------------
--| 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] 19+ messages in thread

* Re: [PATCH 2/2] On Cygwin support both UNIX and DOS style path-names
  2011-08-05 17:35     ` Pascal Obry
@ 2011-08-05 17:39       ` Erik Faye-Lund
  2011-08-05 17:51         ` Erik Faye-Lund
  2011-08-05 18:39         ` Pascal Obry
  2011-08-09 17:30       ` Ramsay Jones
  1 sibling, 2 replies; 19+ messages in thread
From: Erik Faye-Lund @ 2011-08-05 17:39 UTC (permalink / raw)
  To: pascal; +Cc: git

On Fri, Aug 5, 2011 at 7:35 PM, Pascal Obry <pascal@obry.net> wrote:
> Le 05/08/2011 19:29, Erik Faye-Lund a écrit :
>>
>> Cygwin is a unix-layer on top of Windows, designed to play by the
>> POSIX-rules. So why would you want to support Windows-style paths on
>> Cygwin?
>
> Because cygwin toolset does support \.
>

Are you saying that the built-in Cygwin tools (like ls etc) support
Windows-style paths (C:\path\to\file)? If that is the case, I
completely understand the desire to accept Windows-paths.

>> If you want a Git that handles Windows paths, use Git for Windows...
>
> Note that Windows is a special case as even the Win32 API does support \ and
> /, so every tool on Windows seems to handle nicely this. Why not Git, be it
> Cygwin/Git. If it does not break anything else.

If the Cygwin-tools does not support drive-prefixes (i.e "C:\") but
does support both slashes as path-separators, then I agree with the
patch but not with the commit message.

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

* Re: [PATCH 2/2] On Cygwin support both UNIX and DOS style path-names
  2011-08-05 16:10 ` [PATCH 2/2] On Cygwin support both UNIX and DOS style path-names Pascal Obry
  2011-08-05 17:29   ` Erik Faye-Lund
@ 2011-08-05 17:48   ` Junio C Hamano
  2011-08-05 17:58     ` Erik Faye-Lund
  2011-08-06  7:01     ` Pascal Obry
  2011-08-09 17:24   ` Ramsay Jones
  2011-08-09 19:47   ` Johannes Sixt
  3 siblings, 2 replies; 19+ messages in thread
From: Junio C Hamano @ 2011-08-05 17:48 UTC (permalink / raw)
  To: Pascal Obry; +Cc: git, Theo Niessink

Pascal Obry <pascal@obry.net> 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@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) == '\\')

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
 

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

* Re: [PATCH 2/2] On Cygwin support both UNIX and DOS style path-names
  2011-08-05 17:39       ` Erik Faye-Lund
@ 2011-08-05 17:51         ` Erik Faye-Lund
  2011-08-05 18:39         ` Pascal Obry
  1 sibling, 0 replies; 19+ messages in thread
From: Erik Faye-Lund @ 2011-08-05 17:51 UTC (permalink / raw)
  To: pascal; +Cc: git

On Fri, Aug 5, 2011 at 7:39 PM, Erik Faye-Lund <kusmabite@gmail.com> wrote:
> On Fri, Aug 5, 2011 at 7:35 PM, Pascal Obry <pascal@obry.net> wrote:
>> Le 05/08/2011 19:29, Erik Faye-Lund a écrit :
>>>
>>> Cygwin is a unix-layer on top of Windows, designed to play by the
>>> POSIX-rules. So why would you want to support Windows-style paths on
>>> Cygwin?
>>
>> Because cygwin toolset does support \.
>>
>
> Are you saying that the built-in Cygwin tools (like ls etc) support
> Windows-style paths (C:\path\to\file)? If that is the case, I
> completely understand the desire to accept Windows-paths.
>
>>> If you want a Git that handles Windows paths, use Git for Windows...
>>
>> Note that Windows is a special case as even the Win32 API does support \ and
>> /, so every tool on Windows seems to handle nicely this. Why not Git, be it
>> Cygwin/Git. If it does not break anything else.
>
> If the Cygwin-tools does not support drive-prefixes (i.e "C:\") but
> does support both slashes as path-separators, then I agree with the
> patch but not with the commit message.
>

correction: if that is the case, I agree with the is_dir_sep-part, but
not the has_dos_drive_prefix-part of the patch (and also not the
example from the commit message)

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

* Re: [PATCH 2/2] On Cygwin support both UNIX and DOS style path-names
  2011-08-05 17:48   ` Junio C Hamano
@ 2011-08-05 17:58     ` Erik Faye-Lund
  2011-08-06  7:01     ` Pascal Obry
  1 sibling, 0 replies; 19+ messages in thread
From: Erik Faye-Lund @ 2011-08-05 17:58 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Pascal Obry, git, Theo Niessink

On Fri, Aug 5, 2011 at 7:48 PM, Junio C Hamano <gitster@pobox.com> wrote:
> Pascal Obry <pascal@obry.net> 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@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) == '\\')
>
> 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.

IMO this becomes a bit hard to read as you have to ping-pong between
sources to understand exactly what that flag does. We have
compat/win32.h, perhaps we should move the macros there and include it
from both compat/mingw.h and compat/cygwin.h instead (given that we're
going to do this, of course)?

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

* Re: [PATCH 2/2] On Cygwin support both UNIX and DOS style path-names
  2011-08-05 17:39       ` Erik Faye-Lund
  2011-08-05 17:51         ` Erik Faye-Lund
@ 2011-08-05 18:39         ` Pascal Obry
  1 sibling, 0 replies; 19+ messages in thread
From: Pascal Obry @ 2011-08-05 18:39 UTC (permalink / raw)
  To: kusmabite; +Cc: git

Le 05/08/2011 19:39, Erik Faye-Lund a écrit :
> Are you saying that the built-in Cygwin tools (like ls etc) support
> Windows-style paths (C:\path\to\file)? If that is the case, I
> completely understand the desire to accept Windows-paths.

Exactly.

-- 

--|------------------------------------------------------
--| 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] 19+ messages in thread

* Re: [PATCH 2/2] On Cygwin support both UNIX and DOS style path-names
  2011-08-05 17:48   ` Junio C Hamano
  2011-08-05 17:58     ` Erik Faye-Lund
@ 2011-08-06  7:01     ` Pascal Obry
  1 sibling, 0 replies; 19+ messages in thread
From: Pascal Obry @ 2011-08-06  7:01 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git, Theo Niessink

Le 05/08/2011 19:48, Junio C Hamano a écrit :
> I wonder if these two that are the same as mingw should further be
> consolidated into one implementation, something like below.

Fine with me.

-- 

--|------------------------------------------------------
--| 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] 19+ messages in thread

* Re: [PATCH 2/2] On Cygwin support both UNIX and DOS style path-names
  2011-08-05 16:10 ` [PATCH 2/2] On Cygwin support both UNIX and DOS style path-names Pascal Obry
  2011-08-05 17:29   ` Erik Faye-Lund
  2011-08-05 17:48   ` Junio C Hamano
@ 2011-08-09 17:24   ` Ramsay Jones
  2011-08-09 20:38     ` Pascal Obry
  2011-08-10  2:44     ` Vijay Lakshminarayanan
  2011-08-09 19:47   ` Johannes Sixt
  3 siblings, 2 replies; 19+ messages in thread
From: Ramsay Jones @ 2011-08-09 17:24 UTC (permalink / raw)
  To: Pascal Obry; +Cc: git

Pascal Obry wrote:
> 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.

Hmm, are you using bash or cmd.exe? Using bash I get the following:

    $ cd src
    $ git commut -F c:\tmp\log.txt file.c
    fatal: could not read file 'src/c:tmplog.txt': No such file or directory
    $ 

Which is what I would expect of (any) posix shell, viz:

    $ ls c:\
    > ^C
    $ ls c:\\
    AUTOEXEC.BAT*            NTDETECT.COM*               WATCOM/       msysgit/
    CMPNENTS/                Program Files/              WINDOWS/      msysgit-old/
    CONFIG.SYS*              RECYCLER/                   boot.ini*     ntldr*
    Documents and Settings/  SUPPORT/                    cygwin/       pagefile.sys
    I386/                    SWSTAMP.TXT*                cygwintemp/   ssl/
    IO.SYS*                  System Volume Information/  dm/           uname/
    MSDOS.SYS*               TOOLSCD/                    dm840/        zlib/
    MSOCache/                VALUEADD/                   hiberfil.sys
    $ 

If you want to use cmd.exe as your shell, I suspect msysGit (Git For Windows)
may be a better fit.

ATB,
Ramsay Jones

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

* Re: [PATCH 2/2] On Cygwin support both UNIX and DOS style path-names
  2011-08-05 17:29   ` Erik Faye-Lund
  2011-08-05 17:35     ` Pascal Obry
@ 2011-08-09 17:26     ` Ramsay Jones
  1 sibling, 0 replies; 19+ messages in thread
From: Ramsay Jones @ 2011-08-09 17:26 UTC (permalink / raw)
  To: kusmabite; +Cc: Pascal Obry, git

Erik Faye-Lund wrote:
> On Fri, Aug 5, 2011 at 6:10 PM, Pascal Obry <pascal@obry.net> wrote:
>> 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.
> 
> Cygwin is a unix-layer on top of Windows, designed to play by the
> POSIX-rules. So why would you want to support Windows-style paths on
> Cygwin?
> 
> If you want a Git that handles Windows paths, use Git for Windows...

Indeed, I have to agree. This takes the cygwin port in the wrong
direction ...

ATB,
Ramsay Jones

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

* Re: [PATCH 2/2] On Cygwin support both UNIX and DOS style path-names
  2011-08-05 17:35     ` Pascal Obry
  2011-08-05 17:39       ` Erik Faye-Lund
@ 2011-08-09 17:30       ` Ramsay Jones
  1 sibling, 0 replies; 19+ messages in thread
From: Ramsay Jones @ 2011-08-09 17:30 UTC (permalink / raw)
  To: pascal; +Cc: kusmabite, git

Pascal Obry wrote:
> Le 05/08/2011 19:29, Erik Faye-Lund a écrit :
>> Cygwin is a unix-layer on top of Windows, designed to play by the
>> POSIX-rules. So why would you want to support Windows-style paths on
>> Cygwin?
> 
> Because cygwin toolset does support \.

Hmm, if you don't mind escaping it in bash all the time!

> 
>> If you want a Git that handles Windows paths, use Git for Windows...
> 
> Note that Windows is a special case as even the Win32 API does support \ 
> and /, so every tool on Windows seems to handle nicely this. Why not 
> Git, be it Cygwin/Git. If it does not break anything else.

Hmm, I wouldn't be too sure of that, either ...

ATB,
Ramsay Jones

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

* Re: [PATCH 2/2] On Cygwin support both UNIX and DOS style path-names
  2011-08-05 16:10 ` [PATCH 2/2] On Cygwin support both UNIX and DOS style path-names Pascal Obry
                     ` (2 preceding siblings ...)
  2011-08-09 17:24   ` Ramsay Jones
@ 2011-08-09 19:47   ` Johannes Sixt
  3 siblings, 0 replies; 19+ messages in thread
From: Johannes Sixt @ 2011-08-09 19:47 UTC (permalink / raw)
  To: Pascal Obry; +Cc: git

Am 05.08.2011 18:10, schrieb 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.

Do you also want to support this:

     $ git add src\file.c

i.e., backslash in pathspec? Then you need more than this:

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

In particular, you have to enable backslash processing in
setup.c:prefix_filename(), but then you lose the ability to escape
special characters with the backslash.

-- Hannes

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

* Re: [PATCH 2/2] On Cygwin support both UNIX and DOS style path-names
  2011-08-09 17:24   ` Ramsay Jones
@ 2011-08-09 20:38     ` Pascal Obry
  2011-08-11 20:35       ` Ramsay Jones
  2011-08-10  2:44     ` Vijay Lakshminarayanan
  1 sibling, 1 reply; 19+ messages in thread
From: Pascal Obry @ 2011-08-09 20:38 UTC (permalink / raw)
  To: Ramsay Jones; +Cc: git

Le 09/08/2011 19:24, Ramsay Jones a écrit :
> Pascal Obry wrote:
>> 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.
>
> Hmm, are you using bash or cmd.exe? Using bash I get the following:

bash.

>
>      $ cd src
>      $ git commut -F c:\tmp\log.txt file.c
>      fatal: could not read file 'src/c:tmplog.txt': No such file or directory
>      $
>
> Which is what I would expect of (any) posix shell, viz:
>
>      $ ls c:\
>      >  ^C
>      $ ls c:\\
>      AUTOEXEC.BAT*            NTDETECT.COM*               WATCOM/       msysgit/
>      CMPNENTS/                Program Files/              WINDOWS/      msysgit-old/
>      CONFIG.SYS*              RECYCLER/                   boot.ini*     ntldr*
>      Documents and Settings/  SUPPORT/                    cygwin/       pagefile.sys
>      I386/                    SWSTAMP.TXT*                cygwintemp/   ssl/
>      IO.SYS*                  System Volume Information/  dm/           uname/
>      MSDOS.SYS*               TOOLSCD/                    dm840/        zlib/
>      MSOCache/                VALUEADD/                   hiberfil.sys

Exactly, \\ this is what I have used and this is the bug. Cygwin 
supports ls c:\\ so should Cygwin/Git. My quoted example was missing the 
escape \.

-- 

--|------------------------------------------------------
--| 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] 19+ messages in thread

* Re: [PATCH 2/2] On Cygwin support both UNIX and DOS style path-names
  2011-08-09 17:24   ` Ramsay Jones
  2011-08-09 20:38     ` Pascal Obry
@ 2011-08-10  2:44     ` Vijay Lakshminarayanan
  1 sibling, 0 replies; 19+ messages in thread
From: Vijay Lakshminarayanan @ 2011-08-10  2:44 UTC (permalink / raw)
  To: Ramsay Jones; +Cc: Pascal Obry, git

Ramsay Jones <ramsay@ramsay1.demon.co.uk> writes:

> Pascal Obry wrote:
>> 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.
>
> Hmm, are you using bash or cmd.exe? Using bash I get the following:
>
>     $ cd src
>     $ git commut -F c:\tmp\log.txt file.c
>     fatal: could not read file 'src/c:tmplog.txt': No such file or directory
>     $ 
>
> Which is what I would expect of (any) posix shell, viz:
>
>     $ ls c:\
>     > ^C
>     $ ls c:\\
>     AUTOEXEC.BAT*            NTDETECT.COM*               WATCOM/       msysgit/
>     CMPNENTS/                Program Files/              WINDOWS/      msysgit-old/
>     CONFIG.SYS*              RECYCLER/                   boot.ini*     ntldr*
>     Documents and Settings/  SUPPORT/                    cygwin/       pagefile.sys
>     I386/                    SWSTAMP.TXT*                cygwintemp/   ssl/
>     IO.SYS*                  System Volume Information/  dm/           uname/
>     MSDOS.SYS*               TOOLSCD/                    dm840/        zlib/
>     MSOCache/                VALUEADD/                   hiberfil.sys
>     $ 

FWIW, I use git on Cygwin and it works quite well.  Cygwin supports
Windows paths when quoted.  So

$ ls 'C:\Users\vijay\Desktop'

works as expected.  This is very useful when you're copying paths from,
say, Windows Explorer, to Cygwin.

> ATB,
> Ramsay Jones
>
> --
> To unsubscribe from this list: send the line "unsubscribe git" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

-- 
Cheers
~vijay

Gnus should be more complicated.

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

* Re: [PATCH 2/2] On Cygwin support both UNIX and DOS style path-names
  2011-08-09 20:38     ` Pascal Obry
@ 2011-08-11 20:35       ` Ramsay Jones
  2011-08-13 17:34         ` Pascal Obry
  0 siblings, 1 reply; 19+ messages in thread
From: Ramsay Jones @ 2011-08-11 20:35 UTC (permalink / raw)
  To: pascal; +Cc: git

Pascal Obry wrote:
> Le 09/08/2011 19:24, Ramsay Jones a écrit :
>> Pascal Obry wrote:
>>> 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.
>> Hmm, are you using bash or cmd.exe? Using bash I get the following:
> 
> bash.

Ah, OK. The example in your commit message looked odd (ie incorrect) which
made me think that you were probably using cnd.exe, so ...

>>      $ cd src
>>      $ git commut -F c:\tmp\log.txt file.c
>>      fatal: could not read file 'src/c:tmplog.txt': No such file or directory
>>      $
>>
>> Which is what I would expect of (any) posix shell, viz:
>>
>>      $ ls c:\
>>      >  ^C
>>      $ ls c:\\
>>      AUTOEXEC.BAT*            NTDETECT.COM*               WATCOM/       msysgit/
>>      CMPNENTS/                Program Files/              WINDOWS/      msysgit-old/
>>      CONFIG.SYS*              RECYCLER/                   boot.ini*     ntldr*
>>      Documents and Settings/  SUPPORT/                    cygwin/       pagefile.sys
>>      I386/                    SWSTAMP.TXT*                cygwintemp/   ssl/
>>      IO.SYS*                  System Volume Information/  dm/           uname/
>>      MSDOS.SYS*               TOOLSCD/                    dm840/        zlib/
>>      MSOCache/                VALUEADD/                   hiberfil.sys
> 
> Exactly, \\ this is what I have used and this is the bug. Cygwin 
> supports ls c:\\ so should Cygwin/Git. My quoted example was missing the 
> escape \.

 ... could you please correct your commit message. Thanks!

ATB,
Ramsay Jones

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

* Re: [PATCH 2/2] On Cygwin support both UNIX and DOS style path-names
  2011-08-11 20:35       ` Ramsay Jones
@ 2011-08-13 17:34         ` Pascal Obry
  0 siblings, 0 replies; 19+ messages in thread
From: Pascal Obry @ 2011-08-13 17:34 UTC (permalink / raw)
  To: Ramsay Jones; +Cc: git

Le 11/08/2011 22:35, Ramsay Jones a écrit :
>   ... could you please correct your commit message. Thanks!

Done, thanks for your review.

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] 19+ messages in thread

end of thread, other threads:[~2011-08-13 17:34 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-08-05 16:10 [PATH 0/2] On Cygwin support both UNIX and DOS style path-names Pascal Obry
2011-08-05 16:10 ` [PATCH 1/2] git-compat-util: add generic find_last_dir_sep that respects is_dir_sep Pascal Obry
2011-08-05 16:10 ` [PATCH 2/2] On Cygwin support both UNIX and DOS style path-names Pascal Obry
2011-08-05 17:29   ` Erik Faye-Lund
2011-08-05 17:35     ` Pascal Obry
2011-08-05 17:39       ` Erik Faye-Lund
2011-08-05 17:51         ` Erik Faye-Lund
2011-08-05 18:39         ` Pascal Obry
2011-08-09 17:30       ` Ramsay Jones
2011-08-09 17:26     ` Ramsay Jones
2011-08-05 17:48   ` Junio C Hamano
2011-08-05 17:58     ` Erik Faye-Lund
2011-08-06  7:01     ` Pascal Obry
2011-08-09 17:24   ` Ramsay Jones
2011-08-09 20:38     ` Pascal Obry
2011-08-11 20:35       ` Ramsay Jones
2011-08-13 17:34         ` Pascal Obry
2011-08-10  2:44     ` Vijay Lakshminarayanan
2011-08-09 19:47   ` Johannes Sixt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).