{"thread":{"id":"25102","subject":"[PATCH] send-email: use catfile() to concatenate files","startedAt":"2010-09-14T19:02:24Z","lastAt":"2010-09-14T20:42:52Z","messageCount":5,"participants":["Ævar Arnfjörð Bjarmason","Junio C Hamano","Jakub Narebski"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"150703","messageId":"1284490944-16964-1-git-send-email-avarab@gmail.com","threadId":"25102","inReplyTo":null,"subject":"[PATCH] send-email: use catfile() to concatenate files","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2010-09-14T19:02:24Z","receivedAt":"2010-09-14T19:02:24Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Change send-email to use Perl's catfile() function instead of\n\"$dir/$file\". If send-email is given a $dir that ends with a / we'll\nend up printing a double slashed path like \"dir//mtfnpy.patch\".\n\nThis doesn't cause any problems since Perl's IO layer will handle it,\nbut it looks ugly.\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n git-send-email.perl |    3 ++-\n 1 files changed, 2 insertions(+), 1 deletions(-)\n\ndiff --git a/git-send-email.perl b/git-send-email.perl\nindex 6dab3bf..7f702e3 100755\n--- a/git-send-email.perl\n+++ b/git-send-email.perl\n@@ -24,6 +24,7 @@ use Text::ParseWords;\n use Data::Dumper;\n use Term::ANSIColor;\n use File::Temp qw/ tempdir tempfile /;\n+use File::Spec::Functions qw(catfile);\n use Error qw(:try);\n use Git;\n \n@@ -511,7 +512,7 @@ while (defined(my $f = shift @ARGV)) {\n \t\topendir(DH,$f)\n \t\t\tor die \"Failed to opendir $f: $!\";\n \n-\t\tpush @files, grep { -f $_ } map { +$f . \"/\" . $_ }\n+\t\tpush @files, grep { -f $_ } map { catfile($f, $_) }\n \t\t\t\tsort readdir(DH);\n \t\tclosedir(DH);\n \t} elsif ((-f $f or -p $f) and !check_file_rev_conflict($f)) {\n-- \n1.7.3.rc1.234.g8dc15\n"},{"id":"150704","messageId":"7v7hio86tz.fsf@alter.siamese.dyndns.org","threadId":"25102","inReplyTo":"1284490944-16964-1-git-send-email-avarab@gmail.com","subject":"Re: [PATCH] send-email: use catfile() to concatenate files","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2010-09-14T19:26:32Z","receivedAt":"2010-09-14T19:26:32Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Ævar Arnfjörð Bjarmason <avarab@gmail.com> writes:\n\n> Change send-email to use Perl's catfile() function instead of\n> \"$dir/$file\". If send-email is given a $dir that ends with a / we'll\n> end up printing a double slashed path like \"dir//mtfnpy.patch\".\n>\n> This doesn't cause any problems since Perl's IO layer will handle it,\n> but it looks ugly.\n>\n> Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n\nIf you mentioned in the proposed log message that File::Spec::Functions\nhave been with us since Perl 5.6.1, it would have saved me (and others)\nsome time worrying about the portability issues.\n\n>  git-send-email.perl |    3 ++-\n>  1 files changed, 2 insertions(+), 1 deletions(-)\n>\n> diff --git a/git-send-email.perl b/git-send-email.perl\n> index 6dab3bf..7f702e3 100755\n> --- a/git-send-email.perl\n> +++ b/git-send-email.perl\n> @@ -24,6 +24,7 @@ use Text::ParseWords;\n>  use Data::Dumper;\n>  use Term::ANSIColor;\n>  use File::Temp qw/ tempdir tempfile /;\n> +use File::Spec::Functions qw(catfile);\n>  use Error qw(:try);\n>  use Git;\n>  \n> @@ -511,7 +512,7 @@ while (defined(my $f = shift @ARGV)) {\n>  \t\topendir(DH,$f)\n>  \t\t\tor die \"Failed to opendir $f: $!\";\n>  \n> -\t\tpush @files, grep { -f $_ } map { +$f . \"/\" . $_ }\n> +\t\tpush @files, grep { -f $_ } map { catfile($f, $_) }\n>  \t\t\t\tsort readdir(DH);\n>  \t\tclosedir(DH);\n>  \t} elsif ((-f $f or -p $f) and !check_file_rev_conflict($f)) {\n> -- \n> 1.7.3.rc1.234.g8dc15\n"},{"id":"150706","messageId":"AANLkTim7y3qUqQ4TN4w9+5qwR-uLmCP=dTKnMUSnqUrP@mail.gmail.com","threadId":"25102","inReplyTo":"7v7hio86tz.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH] send-email: use catfile() to concatenate files","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2010-09-14T19:55:47Z","receivedAt":"2010-09-14T19:55:47Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"On Tue, Sep 14, 2010 at 19:26, Junio C Hamano <gitster@pobox.com> wrote:\n> Ævar Arnfjörð Bjarmason <avarab@gmail.com> writes:\n>\n>> Change send-email to use Perl's catfile() function instead of\n>> \"$dir/$file\". If send-email is given a $dir that ends with a / we'll\n>> end up printing a double slashed path like \"dir//mtfnpy.patch\".\n>>\n>> This doesn't cause any problems since Perl's IO layer will handle it,\n>> but it looks ugly.\n>>\n>> Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n>\n> If you mentioned in the proposed log message that File::Spec::Functions\n> have been with us since Perl 5.6.1, it would have saved me (and others)\n> some time worrying about the portability issues.\n\nI thought you might trust me to write portable code by default :)\n\nAnyway, I forgot to mention it. But one can use the corelist(1)\nprogram to see when what modules appeared in perl core:\n\n    $ corelist File::Spec::Functions\n    File::Spec::Functions was first released with perl 5.00504\n"},{"id":"150709","messageId":"m3iq28kqs4.fsf@localhost.localdomain","threadId":"25102","inReplyTo":"AANLkTim7y3qUqQ4TN4w9+5qwR-uLmCP=dTKnMUSnqUrP@mail.gmail.com","subject":"Re: [PATCH] send-email: use catfile() to concatenate files","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2010-09-14T20:35:40Z","receivedAt":"2010-09-14T20:35:40Z","isPatch":true,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"Ævar Arnfjörð Bjarmason <avarab@gmail.com> writes:\n> On Tue, Sep 14, 2010 at 19:26, Junio C Hamano <gitster@pobox.com> wrote:\n>> Ævar Arnfjörð Bjarmason <avarab@gmail.com> writes:\n>>\n>>> Change send-email to use Perl's catfile() function instead of\n>>> \"$dir/$file\". If send-email is given a $dir that ends with a / we'll\n>>> end up printing a double slashed path like \"dir//mtfnpy.patch\".\n>>>\n>>> This doesn't cause any problems since Perl's IO layer will handle it,\n>>> but it looks ugly.\n>>>\n>>> Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n>>\n>> If you mentioned in the proposed log message that File::Spec::Functions\n>> have been with us since Perl 5.6.1, it would have saved me (and others)\n>> some time worrying about the portability issues.\n> \n> I thought you might trust me to write portable code by default :)\n> \n> Anyway, I forgot to mention it. But one can use the corelist(1)\n> program to see when what modules appeared in perl core:\n> \n>     $ corelist File::Spec::Functions\n>     File::Spec::Functions was first released with perl 5.00504\n\nAlso using File::Spec / File::Spec::Functions makes code more portable\n(with respect to things such as different directory separators, and\nvolume portion of pathname) than using \"$dir/$file\".\n\n-- \nJakub Narebski\nPoland\nShadeHawk on #git\n"},{"id":"150711","messageId":"AANLkTikEe_KNmXUmTtVSRjKy4QbhAmSJ9jXz2y0dO9Em@mail.gmail.com","threadId":"25102","inReplyTo":"m3iq28kqs4.fsf@localhost.localdomain","subject":"Re: [PATCH] send-email: use catfile() to concatenate files","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2010-09-14T20:42:52Z","receivedAt":"2010-09-14T20:42:52Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"On Tue, Sep 14, 2010 at 20:35, Jakub Narebski <jnareb@gmail.com> wrote:\n> Ævar Arnfjörð Bjarmason <avarab@gmail.com> writes:\n>> On Tue, Sep 14, 2010 at 19:26, Junio C Hamano <gitster@pobox.com> wrote:\n>>> Ævar Arnfjörð Bjarmason <avarab@gmail.com> writes:\n>>>\n>>>> Change send-email to use Perl's catfile() function instead of\n>>>> \"$dir/$file\". If send-email is given a $dir that ends with a / we'll\n>>>> end up printing a double slashed path like \"dir//mtfnpy.patch\".\n>>>>\n>>>> This doesn't cause any problems since Perl's IO layer will handle it,\n>>>> but it looks ugly.\n>>>>\n>>>> Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n>>>\n>>> If you mentioned in the proposed log message that File::Spec::Functions\n>>> have been with us since Perl 5.6.1, it would have saved me (and others)\n>>> some time worrying about the portability issues.\n>>\n>> I thought you might trust me to write portable code by default :)\n>>\n>> Anyway, I forgot to mention it. But one can use the corelist(1)\n>> program to see when what modules appeared in perl core:\n>>\n>>     $ corelist File::Spec::Functions\n>>     File::Spec::Functions was first released with perl 5.00504\n>\n> Also using File::Spec / File::Spec::Functions makes code more portable\n> (with respect to things such as different directory separators, and\n> volume portion of pathname) than using \"$dir/$file\".\n\nRight, but perl mitigates that to some extent by converting Unix paths\non-the-fly\nto whatever the native platform uses. But of course that falls down in\ncases like Win32\nvolume labels.\n"}]}