Re: [PATCH v2] send-email: extract email-parsing code into a subroutine
On Wed, Dec 6, 2017 at 5:55 PM, Nathan PAYREwrote: > Junio C Hamano : writes: >> 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? > > This subroutine will be used to implement, initially a new option called > "--quote-email", but became "--cite" added after "--in-reply-to". > This will permit to the user to cite a mail and reply with a patch and keep > Cc, To ... > See discussion : > https://public-inbox.org/git/20171030223444.5052-1-nathan.pa...@etu.univ-lyon1.fr/ Although he didn't state so explicitly, please take Junio's question as a strong hint that you should update the commit message to include the above rationale/explanation about why you consider this a good change. The reason for including the motivation in the commit message is that you want, not only to convince Junio now that this is a useful change, but to convince future readers of the project history that this change is desirable.
Re: [PATCH v2] send-email: extract email-parsing code into a subroutine
Nathan PAYREwrites: > Junio C Hamano : writes: > >> ... 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 ;-). > > Hmmm I'm wondering who place thoses print in my code ! > I will fix it fast. :-) Don't make waste by being hasty, though. The print statements were bad, but funny indentation was more distracting and will be worse hindrance from the maintainabaility's point of view. Thanks.
Re: [PATCH v2] send-email: extract email-parsing code into a subroutine
Junio C Hamano: writes: > ... 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 ;-). Hmmm I'm wondering who place thoses print in my code ! I will fix it fast. :-) > 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? This subroutine will be used to implement, initially a new option called "--quote-email", but became "--cite" added after "--in-reply-to". This will permit to the user to cite a mail and reply with a patch and keep Cc, To ... See discussion : https://public-inbox.org/git/20171030223444.5052-1-nathan.pa...@etu.univ-lyon1.fr/ And Daniel Timothee and I wanted to refactor an other part of the file using parse_header_line(). Near Line 1570.
Re: [PATCH v2] send-email: extract email-parsing code into a subroutine
Nathan Payrewrites: > 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?