[PATCH 3/3] gitweb: Make 'object' action implicit by using no action URL

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



In format_log_line_html() subroutine gitweb makes (shortened) SHA-1
of an object into hyperlink, as a very simple comittags support.
Usually, but not always this link is to 'commit' object.

In git_print_tree_entry() subroutine gitweb provides link to the
target of symbolic link, for easier navigation, if it looks like it
leads inside tree.  Gitweb doesn't know if it leads to directory
('tree' object), or an ordinary file ('blob' object), or if it is
broken.  (It cn also in rare cases lead to submodule, which now
will result in the 'commit' view).

Both of those cases used generic 'object' action to find correct view
on request, only when link were followed.  Now we make use of the fact
that gitweb tries to find correct action if none provided; it uses
'object' action if action is not provided, but project and either hash
or hash_base and filename are.

Signed-off-by: Jakub Narebski <jnareb@xxxxxxxxx>
---
Hmmmm... isn't this commit message too long for such a simple change?

 gitweb/gitweb.perl |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index f507a5a..a5df2fe 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -1072,7 +1072,7 @@ sub format_log_line_html {
 	if ($line =~ m/([0-9a-fA-F]{8,40})/) {
 		my $hash_text = $1;
 		my $link =
-			$cgi->a({-href => href(action=>"object", hash=>$hash_text),
+			$cgi->a({-href => href(hash=>$hash_text),
 			        -class => "text"}, $hash_text);
 		$line =~ s/$hash_text/$link/;
 	}
@@ -2912,7 +2912,7 @@ sub git_print_tree_entry {
 				my $norm_target = normalize_link_target($link_target, $basedir, $hash_base);
 				if (defined $norm_target) {
 					print " -> " .
-					      $cgi->a({-href => href(action=>"object", hash_base=>$hash_base,
+					      $cgi->a({-href => href(hash_base=>$hash_base,
 					                             file_name=>$norm_target),
 					               -title => $norm_target}, esc_path($link_target));
 				} else {
-- 
1.5.4.3.453.gc1ad83

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux