From: Jakub Narebski <jnareb@gmail.com>
To: git@vger.kernel.org
Cc: Jakub Narebski <jnareb@gmail.com>
Subject: [PATCH 5/6] gitweb: Add links to blobdiffs in from-file/to-file header for merges
Date: Fri, 08 Jun 2007 13:32:44 +0200 [thread overview]
Message-ID: <20070608113000.3594.74677.stgit@roke.D-201> (raw)
In-Reply-To: <20070608112337.3594.93976.stgit@roke.D-201>
Add links to diff to file ('blobdiff' view) for each of individual
versions of the file in a merge commit to the from-file/to-file header
in the patch part of combined 'commitdiff' view for merges.
The from-file/to-file header for combined diff now looks like:
--- _1_/_git-gui/git-gui.sh_
--- _2_/_git-gui.sh_
+++ b/_git-gui/git-gui.sh_
where _<filename>_ link is link to appropriate version of a file
('blob' view), and _<n>_ is link to respective diff to mentioned
version of a file ('blobdiff' view). There is even hint provided in
the form of title attribute.
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
---
As requested by Junio C Hamano and Petr "Pasky" Baudis in:
Message-ID: <7v1wh1en8k.fsf@assigned-by-dhcp.cox.net>
Message-ID: <20070528132959.GT4489@pasky.or.cz>
I don't know if the link placement is best possible; I tried for
combined diff output be similar to ordinary diff output, but also
provide reqeusted additional functionality (which does not make
sense for ordinary diff). You have to know ehere to search for
the link.
gitweb/gitweb.perl | 17 ++++++++++++++---
1 files changed, 14 insertions(+), 3 deletions(-)
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index 13114bc..c7acfad 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -1058,7 +1058,7 @@ sub format_extended_diff_header_line {
# format from-file/to-file diff header
sub format_diff_from_to_header {
- my ($from_line, $to_line, $diffinfo, $from, $to) = @_;
+ my ($from_line, $to_line, $diffinfo, $from, $to, @parents) = @_;
my $line;
my $result = '';
@@ -1084,7 +1084,17 @@ sub format_diff_from_to_header {
for (my $i = 0; $i < $diffinfo->{'nparents'}; $i++) {
if ($from->{'href'}[$i]) {
$line = '--- ' .
- ($i+1) . "/" .
+ $cgi->a({-href=>href(action=>"blobdiff",
+ hash_parent=>$diffinfo->{'from_id'}[$i],
+ hash_parent_base=>$parents[$i],
+ file_parent=>$from->{'file'}[$i],
+ hash=>$diffinfo->{'to_id'},
+ hash_base=>$hash,
+ file_name=>$to->{'file'}),
+ -class=>"path",
+ -title=>"diff" . ($i+1)},
+ $i+1) .
+ '/' .
$cgi->a({-href=>$from->{'href'}[$i], -class=>"path"},
esc_path($from->{'file'}[$i]));
} else {
@@ -3042,7 +3052,8 @@ sub git_patchset_body {
#assert($patch_line =~ m/^\+\+\+/) if DEBUG;
print format_diff_from_to_header($last_patch_line, $patch_line,
- $diffinfo, \%from, \%to);
+ $diffinfo, \%from, \%to,
+ @hash_parents);
# the patch itself
LINE:
next prev parent reply other threads:[~2007-06-08 11:27 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 ` [PATCH 1/6] gitweb: Provide links to commitdiff to each parent in 'commitdiff' view Jakub Narebski
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 ` Jakub Narebski [this message]
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=20070608113000.3594.74677.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).