On Sat, Apr 11, 2009 at 14:22, Junio C Hamano <gitster@xxxxxxxxx> wrote: > Michael Witten <mfwitten@xxxxxxxxx> writes: > >> This should make things a little more robust in terms of user input; >> before, even the program got it wrong by outputting a line with only >> "GIT:", which was left in place as a header, because there would be >> no following space character. > > An alternative could be to add an extra space after the "GIT:" on the > lines the compose template generated by this program, but people can set > their editors to strip trailing whitespaces, so I think yours is a better > approach. I suspect this patch comes from your own experience of getting > bitten by this once, perhaps? My first thought was indeed just to add an extra space, but it occurred to me that it's not easily remembered. Consider the original documentation: > If the body of the message (what you type after the headers and a blank line) only contains blank (or GIT: prefixed) lines the summary won't be sent >> Also, I cleaned up get_patch_subject(). > > Which is a bit iffy. It does not belong to the primary topic of the patch > to begin with, so it shouldn't be in here even if it weren't iffy. I can split it into another patch. > Because "while (<>)" does not localize $_, you are clobbering it in the > caller's context. I do not know if any of the the existing callers cares, > but it is a change in behaviour. How about: while (local $_ = <$fh>) Or, in our case, this: while (my $_ = <$fh>) In testing these, I came across behavior that I think is incorrect, and I have a mind to complain about it to the perl guys: # Well! the print `function' doesn't seem to play by the rules. # Example 0 # I expect the output to be: # 1 # 1 # 3 # and I am right! $_ = 3; { local $_ = 1; print; print "\n"; print $_; print "\n"; } print; print "\n"; ############################################## # Example 1 # I expect the output to be: # 3 # 1 # 3 # But it is: # 1 # 1 # 3 $_ = 3; { my $_ = 1; print; print "\n"; print $_; print "\n"; } print; print "\n"; ############################################### # Example 2 # I expect the output to be: # 1 # 1 # 3 # and I am right! sub my_print { print(shift or $_); } $_ = 3; { local $_ = 1; my_print; print "\n"; my_print $_; print "\n"; } my_print; print "\n"; ############################################### # Example 3 # I expect the output to be: # 3 # 1 # 3 # and I am right this time! sub my_print { print(shift or $_); } $_ = 3; { my $_ = 1; my_print; print "\n"; my_print $_; print "\n"; } my_print; print "\n"; -- 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