]> Lady’s Gitweb - Gitweb/commit
gitweb: Add a feature to show side-by-side diff
authorKato Kazuyoshi <redacted>
Sun, 30 Oct 2011 23:36:22 +0000 (00:36 +0100)
committerLady <redacted>
Mon, 6 Apr 2026 04:51:31 +0000 (00:51 -0400)
commitff4434f6c82a445f77ea5674f9fe4ec702e0e78a0c67c36ea9cfeacde87844c7
tree1a37de28bfc134d8f77d2f288d5fbc487db549cd75c5e3d3f6f273b71acda180
parent7028df23897649c2a5a51b69ef58f4e53e330aa179a95227d5f809c88688f427
gitweb: Add a feature to show side-by-side diff

This commits adds to support for showing "side-by-side" style diff.
Currently you have to hand-craft the URL; navigation for selecting
diff style is to be added in the next commit.

The diff output in unified format from "git diff-tree" is reorganized to
side-by-side style chunk by chunk with format_sidebyside_diff_chunk().
This reorganization requires knowledge about diff line classification,
so format_diff_line() was renamed to process_diff_line(), and changed to
return tuple (list) consisting of class of diff line and of
HTML-formatted (but not wrapped in <div class="diff ...">...</div>) diff
line.  Wrapping is now done by caller, i.e. git_patchset_body().

Gitweb uses float+margin CSS-based layout for "side by side" diff.

You can specify style of diff with "ds" ('diff_style') query
parameter.  Currently supported values are 'inline' and 'sidebyside';
the default is 'inline'.

Another solution would be to use "opt" ('extra_options') for that...
though current use of it in gitweb seems to suggest that "opt" is more
about passing extra options to underlying git commands, and "git diff"
doesn't support '--side-by-side' like GNU diff does, (yet?).

Signed-off-by: Kato Kazuyoshi <redacted>
Signed-off-by: Jakub Narebski <redacted>
Signed-off-by: Junio C Hamano <redacted>
gitweb.perl
static/gitweb.css
This page took 0.34011 seconds and 4 git commands to generate.