]> Lady’s Gitweb - Gitweb/commit
gitweb: Extract print_sidebyside_diff_lines()
authorMichał Kiedrowicz <redacted>
Wed, 11 Apr 2012 21:18:40 +0000 (23:18 +0200)
committerLady <redacted>
Mon, 6 Apr 2026 04:51:32 +0000 (00:51 -0400)
commita2a9fe5a6916fd20cd2a18e0eb8e663b14a1db26474d7a57aac40860faecfbbe
tree45e9a14fb59cff988dbc7b01c72367448f8a7aed8b163a2e93afaee3adfcd3de
parentd7f282a727c1543f204775243adb5e7a9444f220c96ddeb132847f95b79a1b26
gitweb: Extract print_sidebyside_diff_lines()

Currently, print_sidebyside_diff_chunk() does two things: it
accumulates diff lines and prints them.  Accumulation may be used to
perform additional operations on diff lines, so it makes sense to split
these two things.  Thus, whole code that formats and prints diff lines
in the 'side-by-side' manner is moved out of print_sidebyside_diff_chunk()
to a separate subroutine and two conditions that control printing
diff liens are merged.

Thanks to that, we can easily (in later patches) replace call to that
subroutine with a call to more generic print_diff_lines() that will
control whether 'inline' or 'side-by-side' diff should be printed.

As a side effect, context lines are printed just before printing added
and removed lines, and at the end of chunk (previously, they were
printed immediately on the class change).  However, this doesn't change
gitweb output.

The outcome of this patch is that print_sidebyside_diff_chunk() is now
much shorter and easier to read.

While at it, drop the '# assume that it is change' comment.  According
to Jakub Narębski:

What I meant here when I was writing it that they are lines that
changed between two versions, like '!' in original (not unified)
context format.

We can omit this comment.

Signed-off-by: Michał Kiedrowicz <redacted>
Acked-by: Jakub Narębski <redacted>
Signed-off-by: Junio C Hamano <redacted>
gitweb.perl
This page took 0.223111 seconds and 5 git commands to generate.