From: Martin Waitz Date: Wed, 16 Aug 2006 22:28:38 +0000 (+0200) Subject: gitweb: support for "fp" parameter. X-Git-Tag: v1.4.3-rc1~168^2~45 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=5c95fab017681f6ab21bf82c195bf0a3826fe014;p=git.git gitweb: support for "fp" parameter. 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 Signed-off-by: Junio C Hamano --- diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl index 4bffbf27f..43285798e 100755 --- a/gitweb/gitweb.perl +++ b/gitweb/gitweb.perl @@ -119,6 +119,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)) { @@ -192,6 +199,7 @@ sub href(%) { action => "a", project => "p", file_name => "f", + file_parent => "fp", hash => "h", hash_parent => "hp", hash_base => "hb", @@ -1287,8 +1295,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 "\n"; @@ -1309,8 +1316,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 "\n"; } # we should not encounter Unmerged (U) or Unknown (X) status @@ -2304,7 +2310,7 @@ sub git_blobdiff { git_print_page_path($file_name, "blob"); print "
\n" . "
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) . "
\n";