git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 2/2] On Cygwin support both UNIX and DOS style path-names

From
Erik Faye-Lund <kusmabite@gmail.com>
Date
Aug 5, 2011, 17:58 UTC
Message-ID
<CABPQNSb96xdiL=POyrM-vR1f_KN6s+0UwnZ4E3pZ8NoTfSixzw@mail.gmail.com>
In-Reply-To
<7vipqb3g1w.fsf@alter.siamese.dyndns.org>
On Fri, Aug 5, 2011 at 7:48 PM, Junio C Hamano <gitster@pobox.com> wrote:
Show 34 quoted lines
> 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)?

Previous: Junio C HamanoNext: Pascal Obry
Message 12 of 19 in “[PATH 0/2] On Cygwin support both UNIX and DOS style path-names”
  1. Pascal ObryAug 5, 2011
  2. 1/2 git-compat-util: add generic find_last_dir_sep that respects is_dir_sepPascal Obry, Aug 5, 2011
  3. 2/2 On Cygwin support both UNIX and DOS style path-namesPascal Obry, Aug 5, 2011
  4. Erik Faye-LundAug 5, 2011
  5. Pascal ObryAug 5, 2011
  6. Erik Faye-LundAug 5, 2011
  7. Erik Faye-LundAug 5, 2011
  8. Pascal ObryAug 5, 2011
  9. Ramsay JonesAug 9, 2011
  10. Ramsay JonesAug 9, 2011
  11. Junio C HamanoAug 5, 2011
  12. Erik Faye-LundAug 5, 2011
  13. Pascal ObryAug 6, 2011
  14. Ramsay JonesAug 9, 2011
  15. Pascal ObryAug 9, 2011
  16. Ramsay JonesAug 11, 2011
  17. Pascal ObryAug 13, 2011
  18. Vijay LakshminarayananAug 10, 2011
  19. Johannes SixtAug 9, 2011

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.