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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Ævar Arnfjörð Bjarmason <avarab@xxxxxxxxx> 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@xxxxxxxxx>

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.

>  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
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]