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

Re: [PATCH] send-email: use catfile() to concatenate files

From
Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Date
Sep 14, 2010, 20:42 UTC
Message-ID
<AANLkTikEe_KNmXUmTtVSRjKy4QbhAmSJ9jXz2y0dO9Em@mail.gmail.com>
In-Reply-To
<m3iq28kqs4.fsf@localhost.localdomain>
On Tue, Sep 14, 2010 at 20:35, Jakub Narebski <jnareb@gmail.com> wrote:
Show 28 quoted lines
> Ævar Arnfjörð Bjarmason <avarab@gmail.com> writes:
>> On Tue, Sep 14, 2010 at 19:26, Junio C Hamano <gitster@pobox.com> wrote:
>>> Ævar Arnfjörð Bjarmason <avarab@gmail.com> writes:
>>>
>>>> Change send-email to use Perl's catfile() function instead of
>>>> "$dir/$file". If send-email is given a $dir that ends with a / we'll
>>>> end up printing a double slashed path like "dir//mtfnpy.patch".
>>>>
>>>> This doesn't cause any problems since Perl's IO layer will handle it,
>>>> but it looks ugly.
>>>>
>>>> Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
>>>
>>> If you mentioned in the proposed log message that File::Spec::Functions
>>> have been with us since Perl 5.6.1, it would have saved me (and others)
>>> some time worrying about the portability issues.
>>
>> I thought you might trust me to write portable code by default :)
>>
>> Anyway, I forgot to mention it. But one can use the corelist(1)
>> program to see when what modules appeared in perl core:
>>
>>     $ corelist File::Spec::Functions
>>     File::Spec::Functions was first released with perl 5.00504
>
> Also using File::Spec / File::Spec::Functions makes code more portable
> (with respect to things such as different directory separators, and
> volume portion of pathname) than using "$dir/$file".

Right, but perl mitigates that to some extent by converting Unix paths on-the-fly to whatever the native platform uses. But of course that falls down in cases like Win32 volume labels.

Previous: Jakub Narebski
Message 5 of 5 in “send-email: use catfile() to concatenate files”
  1. send-email: use catfile() to concatenate filesÆvar Arnfjörð Bjarmason, Sep 14, 2010
  2. Junio C HamanoSep 14, 2010
  3. Ævar Arnfjörð BjarmasonSep 14, 2010
  4. Jakub NarebskiSep 14, 2010
  5. Ævar Arnfjörð BjarmasonSep 14, 2010

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.