Merge branch 'pb/maint-gitweb-blob-lineno' into maint
authorJunio C Hamano <gitster@pobox.com>
Mon, 16 Nov 2009 07:07:38 +0000 (23:07 -0800)
committerJunio C Hamano <gitster@pobox.com>
Mon, 16 Nov 2009 07:07:38 +0000 (23:07 -0800)
* pb/maint-gitweb-blob-lineno:
gitweb: Fix blob linenr links in pathinfo mode

1  2 
gitweb/gitweb.perl
diff --combined gitweb/gitweb.perl
index 59dca7d3ada7505f155e4aa7890e03b775043212,184b683aa5a1fdf500ea9cb01ab949bad9e95020..c77cd0341d98f6a38af55c6ed6f09704abf4e967
@@@ -1083,7 -1083,8 +1083,7 @@@ sub to_utf8 
  # correct, but quoted slashes look too horrible in bookmarks
  sub esc_param {
        my $str = shift;
 -      $str =~ s/([^A-Za-z0-9\-_.~()\/:@])/sprintf("%%%02X", ord($1))/eg;
 -      $str =~ s/\+/%2B/g;
 +      $str =~ s/([^A-Za-z0-9\-_.~()\/:@ ]+)/CGI::escape($1)/eg;
        $str =~ s/ /\+/g;
        return $str;
  }
@@@ -5064,7 -5065,8 +5064,8 @@@ sub git_blob 
                        chomp $line;
                        $nr++;
                        $line = untabify($line);
-                       printf "<div class=\"pre\"><a id=\"l%i\" href=\"#l%i\" class=\"linenr\">%4i</a> %s</div>\n",
+                       printf "<div class=\"pre\"><a id=\"l%i\" href=\"" . href(-replay => 1)
+                               . "#l%i\" class=\"linenr\">%4i</a> %s</div>\n",
                               $nr, $nr, $nr, esc_html($line, -nbsp=>1);
                }
        }
@@@ -5327,7 -5329,7 +5328,7 @@@ sub git_commit 
                        } @$parents ) .
                        ')';
        }
 -      if (gitweb_check_feature('patches')) {
 +      if (gitweb_check_feature('patches') && @$parents <= 1) {
                $formats_nav .= " | " .
                        $cgi->a({-href => href(action=>"patch", -replay=>1)},
                                "patch");
@@@ -5615,7 -5617,7 +5616,7 @@@ sub git_commitdiff 
                $formats_nav =
                        $cgi->a({-href => href(action=>"commitdiff_plain", -replay=>1)},
                                "raw");
 -              if ($patch_max) {
 +              if ($patch_max && @{$co{'parents'}} <= 1) {
                        $formats_nav .= " | " .
                                $cgi->a({-href => href(action=>"patch", -replay=>1)},
                                        "patch");
@@@ -5823,7 -5825,7 +5824,7 @@@ sub git_commitdiff_plain 
  
  # format-patch-style patches
  sub git_patch {
 -      git_commitdiff(-format => 'patch', -single=> 1);
 +      git_commitdiff(-format => 'patch', -single => 1);
  }
  
  sub git_patches {