Namhyung Kim <namhyung@xxxxxxxxxx> writes: > If $signoff set to 1, the $line would be handled in > the if statement for the both cases. So the outer of > the conditional always sees the $signoff always set > to 0 and no need to check it. Thus we can finally get > rid of it. While this may not change the behaviour of the code, I think that only shows the original is broken. You even have the hint left in the context of your patch: > # print only one empty line > # do not print empty line after signoff > if ($line eq "") { > - next if ($empty || $signoff); > + next if ($empty); Given this input: If $signoff is set to 1, ... ... rid of it. Signed-off-by: N K Signed-off-by: J C H isn't the code trying (and failing) to remove the empty line between the two S-o-b lines? So something like this on top? I renamed "$empty" which is unclear what it means ("We just saw an empty line? What does the variable want us to do?") to "$skip_blank_line" which more clearly instructs us what to do. If we see a blank line when it is set, we skip it. gitweb/gitweb.perl | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl index 7585e08..202286b 100755 --- a/gitweb/gitweb.perl +++ b/gitweb/gitweb.perl @@ -4484,12 +4484,12 @@ sub git_print_log { } # print log - my $empty = 0; + my $skip_blank_line = 0; foreach my $line (@$log) { if ($line =~ m/^ *(signed[ \-]off[ \-]by[ :]|acked[ \-]by[ :]|cc[ :])/i) { - $empty = 0; if (! $opts{'-remove_signoff'}) { print "<span class=\"signoff\">" . esc_html($line) . "</span><br/>\n"; + $skip_blank_line = 1; } next; } @@ -4497,10 +4497,10 @@ sub git_print_log { # print only one empty line # do not print empty line after signoff if ($line eq "") { - next if ($empty); - $empty = 1; + next if ($skip_blank_line); + $skip_blank_line = 1; } else { - $empty = 0; + $skip_blank_line = 0; } print format_log_line_html($line) . "<br/>\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