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

Re: [PATCH v3] send-email: recognize absolute path on Windows

From
Erik Faye-Lund <kusmabite@gmail.com>
Date
Apr 22, 2014, 12:15 UTC
Message-ID
<CABPQNSbcWjg3nLPD9U114zSk5rBNupOGLr901u4ptCkdiiKvCA@mail.gmail.com>
In-Reply-To
<xmqqbnw1i43p.fsf@gitster.dls.corp.google.com>
On Wed, Apr 16, 2014 at 7:19 PM, Junio C Hamano <gitster@pobox.com> wrote:
Show 41 quoted lines
> Junio C Hamano <gitster@pobox.com> writes:
>
>> Erik Faye-Lund <kusmabite@gmail.com> writes:
>>
>>> So let's manually check for these in that case, and fall back to
>>> the File::Spec-helper on other platforms (e.g Win32 with native
>>> Perl)
>>> ...
>>> +sub file_name_is_absolute {
>>> +    my ($path) = @_;
>>> +
>>> +    # msys does not grok DOS drive-prefixes
>>> +    if ($^O eq 'msys') {
>>> +            return ($path =~ m#^/# || $path =~ m#[a-zA-Z]\:#)
>>
>> Shouldn't the latter also be anchored at the beginning of the string
>> with a leading "^"?
>>
>>> +    }
>>> +
>>> +    require File::Spec::Functions;
>>> +    return File::Spec::Functions::file_name_is_absolute($path);
>>
>> We already "use File::Spec qw(something else)" at the beginning, no?
>> Why not throw file_name_is_absolute into that qw() instead?
>
> Ahh, OK, if you did so, you won't have any place to hook the "only
> on msys do this" trick into.
>
> It somehow feels somewhat confusing that we define a sub with the
> same name as the system one, while not overriding it entirely but
> delegate back to the system one.  I am debating myself if it is more
> obvious if it is done this way:
>
>         use File::Spec::Functions qw(file_name_is_absolute);
>         if ($^O eq 'msys') {
>                 sub file_name_is_absolute {
>                         return $_[0] =~ /^\// || $_[0] =~ /^[A-Z]:/i;
>                 }
>         }
>

In this case, we end up requiring that module even when we end up using it, no? Not that I have very strong objections for doing just that, after all, it appears to be built-in. (As you might understand from this message, my perl-fu is really lacking :-P)

-- 
-- 
*** Please reply-to-all at all times ***
*** (do not pretend to know who is subscribed and who is not) ***
*** Please avoid top-posting. ***
The msysGit Wiki is here: https://github.com/msysgit/msysgit/wiki - Github accounts are free.

You received this message because you are subscribed to the Google
Groups "msysGit" group.
To post to this group, send email to msysgit@googlegroups.com
To unsubscribe from this group, send email to
msysgit+unsubscribe@googlegroups.com
For more options, and view previous threads, visit this group at
http://groups.google.com/group/msysgit?hl=en_US?hl=en

--- 
You received this message because you are subscribed to the Google Groups "msysGit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to msysgit+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Previous: brian m. carlsonNext: Junio C Hamano
Message 5 of 7 in “send-email: recognize absolute path on Windows”
  1. send-email: recognize absolute path on WindowsErik Faye-Lund, Apr 16, 2014
  2. Junio C HamanoApr 16, 2014
  3. Junio C HamanoApr 16, 2014
  4. brian m. carlsonApr 17, 2014
  5. Erik Faye-LundApr 22, 2014
  6. Junio C HamanoApr 22, 2014
  7. Erik Faye-LundApr 23, 2014

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.