git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jakub Narebski <jnareb@gmail.com>
To: git@vger.kernel.org
Cc: Jakub Narebski <jnareb@gmail.com>
Subject: [PATCH/RFC] gitweb: Provide links to individual commitdiffs in difftree for merges
Date: Sun, 27 May 2007 01:50:22 +0200	[thread overview]
Message-ID: <1180223422170-git-send-email-jnareb@gmail.com> (raw)

Add to difftree / whatchanged table row with "1", "2", ... links to
'commitdiff' view for diff with n-th parent for merge commits, as a
table header.  This is visible in 'commit' and 'comitdiff' views.  It
is more important for 'commitdiff' view, as in 'commit' view commit
object header has 'diff' links to diff to n-th parent.

To save space links are shown as "n", where "n" is number of a parent,
and not as for example shortened (to 7 characters) sha1 of a parent
commit.  To make it easier to doscover what links is for, encompassing
<th> element has 'title' attribute explaining the link.

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
---
This is my proposal on how to provide links to diffs to individual
parents in the 'commitdiff' view.  This is RFC: please comment if you
like the idea (or not), and what the layout should be, what this
should look like.  Should we add those links only for 'commitdiff'
view, for example?

Some complications in creating layout stem from the fact that "|" is
used as separator, instead of using table border, or cell borders to
separate columns. And we use "|" because in most other places we use
only one cell (column) for the whole series of links.

 gitweb/gitweb.css  |    5 +++++
 gitweb/gitweb.perl |   19 +++++++++++++++++++
 2 files changed, 24 insertions(+), 0 deletions(-)

diff --git a/gitweb/gitweb.css b/gitweb/gitweb.css
index 9f0822f..7908fe3 100644
--- a/gitweb/gitweb.css
+++ b/gitweb/gitweb.css
@@ -181,10 +181,15 @@ table.diff_tree {
 	font-family: monospace;
 }
 
+table.combined.diff_tree th {
+	text-align: center;
+}
+
 table.combined.diff_tree td {
 	padding-right: 24px;
 }
 
+table.combined.diff_tree th.link,
 table.combined.diff_tree td.link {
 	padding: 0px 2px;
 }
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index c3921cb..999353d 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -2380,6 +2380,25 @@ sub git_difftree_body {
 	print "<table class=\"" .
 	      (@parents > 1 ? "combined " : "") .
 	      "diff_tree\">\n";
+
+	if (@parents > 1) { #combined diff
+		# table header for combined diff
+		print "<tr>\n" .
+		      ($action eq 'commitdiff' ? "<th></th><th></th>\n"
+		                               : "<th></th>\n");
+		for (my $i = 0; $i < @parents; $i++) {
+			my $par = $parents[$i];
+			print "<th title=\"commitdiff to parent number " .
+			      ($i+1) . ": " .
+			      substr($par,0,7) . "\">" .
+			      $cgi->a({-href => href(action=>"commitdiff",
+			                             hash=>$hash, hash_parent=>$par)},
+			              $i+1) .
+			      "&nbsp;</th>\n";
+		}
+		print "</tr>\n";
+	}
+
 	my $alternate = 1;
 	my $patchno = 0;
 	foreach my $line (@{$difftree}) {
-- 
1.5.2

                 reply	other threads:[~2007-05-26 23:46 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1180223422170-git-send-email-jnareb@gmail.com \
    --to=jnareb@gmail.com \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).