From: Jakub Narebski <jnareb@gmail.com>
To: git@vger.kernel.org
Cc: Jakub Narebski <jnareb@gmail.com>
Subject: [PATCH 1/6] gitweb: Provide links to commitdiff to each parent in 'commitdiff' view
Date: Fri, 08 Jun 2007 13:24:56 +0200 [thread overview]
Message-ID: <20070608112419.3594.94911.stgit@roke.D-201> (raw)
In-Reply-To: <20070608112337.3594.93976.stgit@roke.D-201>
Since commit-fb1dde4a we show combined diff for merges in 'commitdiff'
view, and since commit-208ecb2e also in 'commit' view. Sometimes
though one would want to see diff to one of merge commit parents. It
is easy in 'commit' view: in the commit header part there are "diff"
links for each of parent header. This commit adds such links also for
'commitdiff' view.
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 only in 'comitdiff' view, and only for
a merge commit (comit with more than one 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 discover what links is for, each link
has 'title' attribute explaining the link.
Note that one would need to remember that difftree table in 'commit'
view has one less column (it doesn't have "patch" link column), if one
would want to add such table header also in 'commit' view.
Example output:
1 2 3
Makefile patch | diff1 | diff2 | diff3 | blob | history
cache.h patch | diff1 | diff2 | diff3 | blob | history
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
---
gitweb/gitweb.css | 5 +++++
gitweb/gitweb.perl | 21 +++++++++++++++++++++
2 files changed, 26 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 e92596c..e2d5222 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -2401,6 +2401,26 @@ sub git_difftree_body {
print "<table class=\"" .
(@parents > 1 ? "combined " : "") .
"diff_tree\">\n";
+
+ # header only for combined diff in 'commitdiff' view
+ my $has_header = @parents > 1 && $action eq 'commitdiff';
+ if ($has_header) {
+ # table header
+ print "<thead><tr>\n" .
+ "<th></th><th></th>\n"; # filename, patchN link
+ for (my $i = 0; $i < @parents; $i++) {
+ my $par = $parents[$i];
+ print "<th>" .
+ $cgi->a({-href => href(action=>"commitdiff",
+ hash=>$hash, hash_parent=>$par),
+ -title => 'commitdiff to parent number ' .
+ ($i+1) . ': ' . substr($par,0,7)},
+ $i+1) .
+ " </th>\n";
+ }
+ print "</tr></thead>\n<tbody>\n";
+ }
+
my $alternate = 1;
my $patchno = 0;
foreach my $line (@{$difftree}) {
@@ -2673,6 +2693,7 @@ sub git_difftree_body {
} # we should not encounter Unmerged (U) or Unknown (X) status
print "</tr>\n";
}
+ print "</tbody>" if $has_header;
print "</table>\n";
}
next prev parent reply other threads:[~2007-06-08 11:20 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-06-08 11:24 [PATCH 0/6] gitweb: 'commitdiff' view improvements Jakub Narebski
2007-06-08 11:24 ` Jakub Narebski [this message]
2007-06-08 11:26 ` [PATCH 2/6] gitweb: Improve "next" link in commitdiff view Jakub Narebski
2007-06-08 11:27 ` [PATCH 3/6] gitweb: Split git_patchset_body into separate subroutines Jakub Narebski
2007-06-08 11:29 ` [PATCH 4/6] gitweb: Create special from-file/to-file header for combined diff Jakub Narebski
2007-06-08 11:32 ` [PATCH 5/6] gitweb: Add links to blobdiffs in from-file/to-file header for merges Jakub Narebski
2007-06-08 11:33 ` [PATCH 6/6] gitweb: '--cc' for merges in 'commitdiff' view Jakub Narebski
2007-06-11 0:36 ` [PATCH 0/6] gitweb: 'commitdiff' view improvements Junio C Hamano
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=20070608112419.3594.94911.stgit@roke.D-201 \
--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).