summaryrefslogtreecommitdiff
path: root/gitweb/static
diff options
context:
space:
mode:
authorLibravatar Kato Kazuyoshi <kato.kazuyoshi@gmail.com>2011-10-31 00:36:22 +0100
committerLibravatar Junio C Hamano <gitster@pobox.com>2011-10-31 15:22:56 -0700
commit6ba1eb51b94c4777d84e4c9c868096735b1e16dd (patch)
tree1ec8e18185d6f8d5f16981831ba59bbce2e3b142 /gitweb/static
parentgitweb: Extract formatting of diff chunk header (diff)
downloadtgif-6ba1eb51b94c4777d84e4c9c868096735b1e16dd.tar.xz
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 <kato.kazuyoshi@gmail.com> Signed-off-by: Jakub Narebski <jnareb@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'gitweb/static')
-rw-r--r--gitweb/static/gitweb.css17
1 files changed, 17 insertions, 0 deletions
diff --git a/gitweb/static/gitweb.css b/gitweb/static/gitweb.css
index 7d88509208..21842a66ac 100644
--- a/gitweb/static/gitweb.css
+++ b/gitweb/static/gitweb.css
@@ -475,6 +475,23 @@ div.diff.nodifferences {
color: #600000;
}
+/* side-by-side diff */
+div.chunk_block {
+ overflow: hidden;
+}
+
+div.chunk_block div.old {
+ float: left;
+ width: 50%;
+ overflow: hidden;
+}
+
+div.chunk_block div.new {
+ margin-left: 50%;
+ width: 50%;
+}
+
+
div.index_include {
border: solid #d9d8d1;
border-width: 0px 0px 1px;