From: Martin Waitz <tali@admingilde.org>
To: git@vger.kernel.org
Cc: Martin Waitz <tali@admingilde.org>
Subject: [PATCH] gitweb: support for "fp" parameter.
Date: Thu, 17 Aug 2006 00:28:38 +0200 [thread overview]
Message-ID: <1155767325181-git-send-email-tali@admingilde.org> (raw)
In-Reply-To: <11557673212235-git-send-email-tali@admingilde.org>
The "fp" (file name parent) parameter was previously generated for
blob diffs of renamed files. However, it was not used in any code.
Now href() can generate "fp" parameters and they are used by the
blobdiff code to show the correct file name.
Signed-off-by: Martin Waitz <tali@admingilde.org>
---
gitweb/gitweb.perl | 16 +++++++++++-----
1 files changed, 11 insertions(+), 5 deletions(-)
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index ed6bd0e..a022569 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -124,6 +124,13 @@ if (defined $file_name) {
}
}
+our $file_parent = $cgi->param('fp');
+if (defined $file_parent) {
+ if (!validate_input($file_parent)) {
+ die_error(undef, "Invalid file parent parameter");
+ }
+}
+
our $hash = $cgi->param('h');
if (defined $hash) {
if (!validate_input($hash)) {
@@ -197,6 +204,7 @@ sub href(%) {
action => "a",
project => "p",
file_name => "f",
+ file_parent => "fp",
hash => "h",
hash_parent => "hp",
hash_base => "hb",
@@ -1282,8 +1290,7 @@ sub git_difftree_body {
$cgi->a({-href => href(action=>"blob", hash=>$to_id, hash_base=>$hash, file_name=>$to_file)}, "blob");
if ($to_id ne $from_id) {
print " | " .
- $cgi->a({-href => "$my_uri?" .
- esc_param("p=$project;a=blobdiff;h=$to_id;hp=$from_id;hb=$hash;f=$to_file;fp=$from_file")}, "diff");
+ $cgi->a({-href => href(action=>"blobdiff", hash=>$to_id, hash_parent=>$from_id, hash_base=>$hash, file_name=>$to_file, file_parent=>$from_file)}, "diff");
}
print "</td>\n";
@@ -1304,8 +1311,7 @@ sub git_difftree_body {
$cgi->a({-href => href(action=>"blob", hash=>$to_id, hash_base=>$hash, file_name=>$to_file)}, "blob");
if ($to_id ne $from_id) {
print " | " .
- $cgi->a({-href => "$my_uri?" .
- esc_param("p=$project;a=blobdiff;h=$to_id;hp=$from_id;hb=$hash;f=$to_file;fp=$from_file")}, "diff");
+ $cgi->a({-href => href(action=>"blobdiff", hash=>$to_id, hash_parent=>$from_id, hash_base=>$hash, file_name=>$to_file, file_parent=>$from_file)}, "diff");
}
print "</td>\n";
} # we should not encounter Unmerged (U) or Unknown (X) status
@@ -2290,7 +2296,7 @@ sub git_blobdiff {
git_print_page_path($file_name, "blob");
print "<div class=\"page_body\">\n" .
"<div class=\"diff_info\">blob:" .
- $cgi->a({-href => href(action=>"blob", hash=>$hash_parent, hash_base=>$hash_base, file_name=>$file_name)}, $hash_parent) .
+ $cgi->a({-href => href(action=>"blob", hash=>$hash_parent, hash_base=>$hash_base, file_name=>($file_parent || $file_name))}, $hash_parent) .
" -> blob:" .
$cgi->a({-href => href(action=>"blob", hash=>$hash, hash_base=>$hash_base, file_name=>$file_name)}, $hash) .
"</div>\n";
--
1.4.2.rc2.gf055
next prev parent reply other threads:[~2006-08-16 22:29 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-08-16 22:28 [PATCH] gitweb: continue consolidation of URL generation Martin Waitz
2006-08-16 22:28 ` [PATCH] gitweb: use common parameter parsing and generation for "o", too Martin Waitz
2006-08-16 22:28 ` Martin Waitz [this message]
2006-08-16 22:28 ` [PATCH] gitweb: support for / as home_link Martin Waitz
2006-08-16 22:28 ` [PATCH] gitweb: fix project list if PATH_INFO=="/" Martin Waitz
2006-08-16 22:28 ` [PATCH] gitweb: use action dispatcher for non-project actions, too Martin Waitz
2006-08-17 2:06 ` Junio C Hamano
2006-08-17 15:00 ` Carl Worth
2006-08-18 13:16 ` Petr Baudis
2006-08-18 14:03 ` Carl Worth
2006-08-18 14:22 ` Jakub Narebski
2006-08-18 15:40 ` Petr Baudis
2006-08-17 19:43 ` Martin Waitz
2006-08-17 9:41 ` Jakub Narebski
2006-08-17 19:49 ` Martin Waitz
2006-08-17 20:00 ` Jakub Narebski
2006-08-17 9:35 ` [PATCH] gitweb: use common parameter parsing and generation for "o", too Jakub Narebski
2006-08-17 19:13 ` Martin Waitz
2006-08-17 19:34 ` Jakub Narebski
2006-08-18 20:20 ` Martin Waitz
2006-08-19 10:55 ` Jakub Narebski
2006-08-19 18:33 ` Martin Waitz
2006-08-19 21:44 ` Jakub Narebski
2006-08-17 1:59 ` [PATCH] gitweb: continue consolidation of URL generation Junio C Hamano
2006-08-17 19:32 ` Martin Waitz
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=1155767325181-git-send-email-tali@admingilde.org \
--to=tali@admingilde.org \
--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).