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

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

From
Junio C Hamano <gitster@pobox.com>
Date
Sep 14, 2010, 19:26 UTC
Message-ID
<7v7hio86tz.fsf@alter.siamese.dyndns.org>
In-Reply-To
<1284490944-16964-1-git-send-email-avarab@gmail.com>
Ævar Arnfjörð Bjarmason <avarab@gmail.com> writes:
Show 8 quoted lines
> 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.

Show 26 quoted lines
>  git-send-email.perl |    3 ++-
>  1 files changed, 2 insertions(+), 1 deletions(-)
>
> diff --git a/git-send-email.perl b/git-send-email.perl
> index 6dab3bf..7f702e3 100755
> --- a/git-send-email.perl
> +++ b/git-send-email.perl
> @@ -24,6 +24,7 @@ use Text::ParseWords;
>  use Data::Dumper;
>  use Term::ANSIColor;
>  use File::Temp qw/ tempdir tempfile /;
> +use File::Spec::Functions qw(catfile);
>  use Error qw(:try);
>  use Git;
>  
> @@ -511,7 +512,7 @@ while (defined(my $f = shift @ARGV)) {
>  		opendir(DH,$f)
>  			or die "Failed to opendir $f: $!";
>  
> -		push @files, grep { -f $_ } map { +$f . "/" . $_ }
> +		push @files, grep { -f $_ } map { catfile($f, $_) }
>  				sort readdir(DH);
>  		closedir(DH);
>  	} elsif ((-f $f or -p $f) and !check_file_rev_conflict($f)) {
> -- 
> 1.7.3.rc1.234.g8dc15
Previous: Ævar Arnfjörð BjarmasonNext: Ævar Arnfjörð Bjarmason
Message 2 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.