Skip to content

Commit 1655c98

Browse files
jnarebgitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 1be224b commit 1655c98

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

gitweb/gitweb.perl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5328,7 +5328,7 @@ sub git_commit {
53285328
} @$parents ) .
53295329
')';
53305330
}
5331-
if (gitweb_check_feature('patches')) {
5331+
if (gitweb_check_feature('patches') && @$parents <= 1) {
53325332
$formats_nav .= " | " .
53335333
$cgi->a({-href => href(action=>"patch", -replay=>1)},
53345334
"patch");
@@ -5616,7 +5616,7 @@ sub git_commitdiff {
56165616
$formats_nav =
56175617
$cgi->a({-href => href(action=>"commitdiff_plain", -replay=>1)},
56185618
"raw");
5619-
if ($patch_max) {
5619+
if ($patch_max && @{$co{'parents'}} <= 1) {
56205620
$formats_nav .= " | " .
56215621
$cgi->a({-href => href(action=>"patch", -replay=>1)},
56225622
"patch");
@@ -5824,7 +5824,7 @@ sub git_commitdiff_plain {
58245824

58255825
# format-patch-style patches
58265826
sub git_patch {
5827-
git_commitdiff(-format => 'patch', -single=> 1);
5827+
git_commitdiff(-format => 'patch', -single => 1);
58285828
}
58295829

58305830
sub git_patches {

0 commit comments

Comments
 (0)