]> Lady’s Gitweb - Gitweb/blobdiff - gitweb.perl
gitweb: Do not show 'patch' link for merge commits
[Gitweb] / gitweb.perl
index 03900fa1d82a9b3a65baa7b9e5449aacff85cac29d70434ebd3e2ad8c215eefc..924d62614a007781297450007174f389b2822b3b929ca2da921a1d54a613b4aa 100755 (executable)
@@ -5375,8 +5375,11 @@ sub git_snapshot {
                die_error(403, "Unsupported snapshot format");
        }
 
-       if (!defined $hash) {
-               $hash = git_get_head_hash($project);
+       my $type = git_get_type("$hash^{}");
+       if (!$type) {
+               die_error(404, 'Object does not exist');
+       }  elsif ($type eq 'blob') {
+               die_error(400, 'Object is not a tree-ish');
        }
 
        my $name = $project;
@@ -5507,7 +5510,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");
@@ -5795,7 +5798,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");
@@ -6003,7 +6006,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 {
This page took 0.27074 seconds and 4 git commands to generate.