]> Lady’s Gitweb - Gitweb/blobdiff - gitweb.perl
gitweb: Test if $from_id and $to_id are defined before comparison
[Gitweb] / gitweb.perl
index 68ef52eefb0b7b6d0d1f2af2c54eb624da27d6fc81b3941d3e955901e1f64a6a..e4c20cca00ae4ff6d9a190ef0b0c348ca8c5ae35bff4f2f795d7505182169415 100755 (executable)
@@ -459,10 +459,16 @@ my %actions = (
        "project_index" => \&git_project_index,
 );
 
-if (defined $project) {
-       $action ||= 'summary';
-} else {
-       $action ||= 'project_list';
+if (!defined $action) {
+       if (defined $hash) {
+               $action = git_get_type($hash);
+       } elsif (defined $hash_base && defined $file_name) {
+               $action = git_get_type("$hash_base:$file_name");
+       } elsif (defined $project) {
+               $action = 'summary';
+       } else {
+               $action = 'project_list';
+       }
 }
 if (!defined($actions{$action})) {
        die_error(undef, "Unknown action");
@@ -2655,9 +2661,10 @@ sub git_patchset_body {
                # check if current patch belong to current raw line
                # and parse raw git-diff line if needed
                if (defined $diffinfo &&
+                   defined $from_id && defined $to_id &&
                    from_ids_eq($diffinfo->{'from_id'}, $from_id) &&
                    $diffinfo->{'to_id'} eq $to_id) {
-                       # this is split patch
+                       # this is continuation of a split patch
                        print "<div class=\"patch cont\">\n";
                } else {
                        # advance raw git-diff output if needed
@@ -4027,14 +4034,13 @@ sub git_commit {
                $parent = "--root";
        }
        my @difftree;
-       if (@$parents <= 1) {
-               # difftree output is not printed for merges
-               open my $fd, "-|", git_cmd(), "diff-tree", '-r', "--no-commit-id",
-                       @diff_opts, $parent, $hash, "--"
-                       or die_error(undef, "Open git-diff-tree failed");
-               @difftree = map { chomp; $_ } <$fd>;
-               close $fd or die_error(undef, "Reading git-diff-tree failed");
-       }
+       open my $fd, "-|", git_cmd(), "diff-tree", '-r', "--no-commit-id",
+               @diff_opts,
+               (@$parents <= 1 ? $parent : '-c'),
+               $hash, "--"
+               or die_error(undef, "Open git-diff-tree failed");
+       @difftree = map { chomp; $_ } <$fd>;
+       close $fd or die_error(undef, "Reading git-diff-tree failed");
 
        # non-textual hash id's can be cached
        my $expires;
@@ -4112,10 +4118,7 @@ sub git_commit {
        git_print_log($co{'comment'});
        print "</div>\n";
 
-       if (@$parents <= 1) {
-               # do not output difftree/whatchanged for merges
-               git_difftree_body(\@difftree, $hash, $parent);
-       }
+       git_difftree_body(\@difftree, $hash, @$parents);
 
        git_footer_html();
 }
This page took 0.233773 seconds and 4 git commands to generate.