@matheusbsbs / matheus-bagliano / commits / 1655c98790
Fork 0

gitweb: Do not show 'patch' link for merge commits

The 'patch' view is about generating text/plain patch that can be given to "git am", and "git am" doesn't understand merges anyway. Therefore link to 'patch' view should not be shown for merge commits. Also call to git-format-patch inside the 'patch' action would fail when 'patch' action is called for a merge commit, with "Reading git-format-patch failed" text as 'patch' view body. Signed-off-by: Jakub Narebski <jnareb@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Jakub Narebski committed Oct 9, 2009 at 14:26 UTC 1655c98790682aed8892eb8a9eb6d44e00d5f69f
1 file changed +3 -3
gitweb/gitweb.perl
+3 -3
@@ -5328,7 +5328,7 @@ sub git_commit {
5328 } @$parents ) .
5329 ')';
5330 }
5331 - if (gitweb_check_feature('patches')) {
5331 + if (gitweb_check_feature('patches') && @$parents <= 1) {
5332 $formats_nav .= " | " .
5333 $cgi->a({-href => href(action=>"patch", -replay=>1)},
5334 "patch");
@@ -5616,7 +5616,7 @@ sub git_commitdiff {
5616 $formats_nav =
5617 $cgi->a({-href => href(action=>"commitdiff_plain", -replay=>1)},
5618 "raw");
5619 - if ($patch_max) {
5619 + if ($patch_max && @{$co{'parents'}} <= 1) {
5620 $formats_nav .= " | " .
5621 $cgi->a({-href => href(action=>"patch", -replay=>1)},
5622 "patch");
@@ -5824,7 +5824,7 @@ sub git_commitdiff_plain {
5824
5825 # format-patch-style patches
5826 sub git_patch {
5827 - git_commitdiff(-format => 'patch', -single=> 1);
5827 + git_commitdiff(-format => 'patch', -single => 1);
5828 }
5829
5830 sub git_patches {