Skip to content

Commit

Permalink
gitweb: Do not show 'patch' link for merge commits
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Jakub Narebski authored and Junio C Hamano committed Oct 9, 2009
1 parent 1be224b commit 1655c98
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions gitweb/gitweb.perl
Original file line number Diff line number Diff line change
Expand Up @@ -5328,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");
Expand Down Expand Up @@ -5616,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");
Expand Down Expand Up @@ -5824,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 {
Expand Down

0 comments on commit 1655c98

Please sign in to comment.