path: root/git-send-email.perl
diff options
authorÆvar Arnfjörð Bjarmason <>2010-09-30 13:43:09 (GMT)
committerJunio C Hamano <>2010-09-30 19:20:33 (GMT)
commit41ae8f1d6cf70f32328c984cdbe51d0f156cd501 (patch)
treef97db962830780cbd84bab82d54144d5dc7e5c64 /git-send-email.perl
parent529dd386dda6c6e6d0dad801785d2d943756fb3f (diff)
send-email: use Perl idioms in while loop
Change `while(<$fh>) { my $c = $_' to `while(my $c = <$fh>) {', and use `chomp $c' instead of `$c =~ s/\n$//g;', the two are equivalent in this case. I've also changed the --cccmd test so that we test for the stripping of whitespace at the beginning of the lines returned from the --cccmd. I think we probably shouldn't do this, but it was there already so I haven't changed the behavior. Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.comReviewed-by: Avery Pennarun <> Reviewed-by: Jeff King <> > Signed-off-by: Junio C Hamano <>
Diffstat (limited to 'git-send-email.perl')
1 files changed, 2 insertions, 3 deletions
diff --git a/git-send-email.perl b/git-send-email.perl
index bfc6d4b..036e4b4 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -1252,10 +1252,9 @@ foreach my $t (@files) {
if (defined $cc_cmd && !$suppress_cc{'cccmd'}) {
open my $fh, "$cc_cmd \Q$t\E |"
or die "(cc-cmd) Could not execute '$cc_cmd'";
- while(<$fh>) {
- my $c = $_;
+ while(my $c = <$fh>) {
+ chomp $c;
$c =~ s/^\s*//g;
- $c =~ s/\n$//g;
next if ($c eq $sender and $suppress_from);
push @cc, $c;
printf("(cc-cmd) Adding cc: %s from: '%s'\n",