Merge branch 'gb/maint-gitweb-esc-param' into maint
authorJunio C Hamano <gitster@pobox.com>
Mon, 16 Nov 2009 00:37:39 +0000 (16:37 -0800)
committerJunio C Hamano <gitster@pobox.com>
Mon, 16 Nov 2009 00:37:39 +0000 (16:37 -0800)
* gb/maint-gitweb-esc-param:
gitweb: fix esc_param

1  2 
gitweb/gitweb.perl
diff --combined gitweb/gitweb.perl
index c939e2434d5901f0de50c649c5443c026d545a98,4b21ad25df804233799ec7eee3d79614662a1c8c..59dca7d3ada7505f155e4aa7890e03b775043212
@@@ -1083,8 -1083,7 +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;
  }
@@@ -5328,7 -5327,7 +5327,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");
@@@ -5616,7 -5615,7 +5615,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");
@@@ -5824,7 -5823,7 +5823,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 {