From: Junio C Hamano Date: Wed, 06 Dec 2017 21:39:22 GMT Subject: Re: [PATCH v2] send-email: extract email-parsing code into a subroutine Message-ID: In-Reply-To: <20171206153821.24435-1-nathan.payre@etu.univ-lyon1.fr> Nathan Payre writes: > The existing code mixes parsing of email header with regular > expression and actual code. Extract the parsing code into a new > subroutine 'parse_header_line()'. This improves the code readability > and make parse_header_line reusable in other place. > > Signed-off-by: Nathan Payre > Signed-off-by: Matthieu Moy > Signed-off-by: Timothee Albertin > Signed-off-by: Daniel Bensoussan > Thanks-to: Ævar Arnfjörð Bjarmason Thanks, but... > + my %parsed_email; > + $parsed_email{'body'} = ''; > + while (my $line = <$c>) { > + next if $line =~ m/^GIT:/; > + parse_header_line($line, \%parsed_email); > + if ($line =~ /^\n$/i) { > + while (my $body_line = <$c>) { > + if ($body_line !~ m/^GIT:/) { > + $parsed_email{'body'} = $parsed_email{'body'} . $body_line; > + } > + } > + } > + print "la : $line\n"; > + } ... throughout this patch, not limited to this section, indentation is strange and there seem to be many "print" that show messages that do not seem to be meant for end-user consumption. I can see that this aspires to improve the readability, but not quite yet ;-). Also "reusable in other place" is by itself not an unconditional plus, until readers can be convinced that that 'other place' really wants to be able to call this function. Is there some untold motivation behind this change---such as a planned update to actually use this helper subroutine?