diff-highlight: use flush() helper consistently
[gitweb.git] / contrib / diff-highlight / DiffHighlight.pm
index 663992e530c82f891361ccc9b952099aff3d56ec..e07cd5931dcdbd476fceddaff9825163a20ed54d 100644 (file)
@@ -46,10 +46,7 @@ sub handle_line {
                push @added, $_;
        }
        else {
-               show_hunk(\@removed, \@added);
-               @removed = ();
-               @added = ();
-
+               flush();
                $line_cb->($_);
                $in_hunk = /^$GRAPH*$COLOR*[\@ ]/;
        }
@@ -71,6 +68,8 @@ sub flush {
        # Flush any queued hunk (this can happen when there is no trailing
        # context in the final diff of the input).
        show_hunk(\@removed, \@added);
+       @removed = ();
+       @added = ();
 }
 
 sub highlight_stdin {