@@ -512,8 +512,9 @@ sub split_addrs {
512
512
513
513
($sender ) = expand_aliases($sender ) if defined $sender ;
514
514
515
- # returns 1 if the conflict must be solved using it as a format-patch argument
516
- sub check_file_rev_conflict ($) {
515
+ # is_format_patch_arg($f) returns 0 if $f names a patch, or 1 if
516
+ # $f is a revision list specification to be passed to format-patch.
517
+ sub is_format_patch_arg {
517
518
return unless $repo ;
518
519
my $f = shift ;
519
520
try {
529
530
* Giving --format-patch option if you mean a range.
530
531
EOF
531
532
} catch Git::Error::Command with {
533
+ # Not a valid revision. Treat it as a filename.
532
534
return 0;
533
535
}
534
536
}
@@ -540,14 +542,14 @@ ($)
540
542
if ($f eq " --" ) {
541
543
push @rev_list_opts , " --" , @ARGV ;
542
544
@ARGV = ();
543
- } elsif (-d $f and !check_file_rev_conflict ($f )) {
545
+ } elsif (-d $f and !is_format_patch_arg ($f )) {
544
546
opendir my $dh , $f
545
547
or die " Failed to opendir $f : $! " ;
546
548
547
549
push @files , grep { -f $_ } map { catfile($f , $_ ) }
548
550
sort readdir $dh ;
549
551
closedir $dh ;
550
- } elsif ((-f $f or -p $f ) and !check_file_rev_conflict ($f )) {
552
+ } elsif ((-f $f or -p $f ) and !is_format_patch_arg ($f )) {
551
553
push @files , $f ;
552
554
} else {
553
555
push @rev_list_opts , $f ;
@@ -711,7 +713,7 @@ sub ask {
711
713
}
712
714
}
713
715
}
714
- return undef ;
716
+ return ;
715
717
}
716
718
717
719
my %broken_encoding ;
@@ -833,7 +835,7 @@ sub extract_valid_address {
833
835
# less robust/correct than the monster regexp in Email::Valid,
834
836
# but still does a 99% job, and one less dependency
835
837
return $1 if $address =~ / ($local_part_regexp \@ $domain_regexp )/ ;
836
- return undef ;
838
+ return ;
837
839
}
838
840
839
841
sub extract_valid_address_or_die {
@@ -1438,7 +1440,7 @@ sub recipients_cmd {
1438
1440
1439
1441
my $sanitized_sender = sanitize_address($sender );
1440
1442
my @addresses = ();
1441
- open my $fh , " $cmd \Q $file \E | "
1443
+ open my $fh , " -| " , " $cmd \Q $file \E "
1442
1444
or die " ($prefix ) Could not execute '$cmd '" ;
1443
1445
while (my $address = <$fh >) {
1444
1446
$address =~ s / ^\s *// g ;
@@ -1484,7 +1486,7 @@ sub validate_patch {
1484
1486
return " $. : patch contains a line longer than 998 characters" ;
1485
1487
}
1486
1488
}
1487
- return undef ;
1489
+ return ;
1488
1490
}
1489
1491
1490
1492
sub file_has_nonascii {
0 commit comments