404 Not Found – Missing one of the blob diff parameters

On my local ikiwiki, I use gitweb to browse the file histories. If I click on history in my ikiwiki and then on diff to current in gitweb it points me to a URL like the following:

http://localhost/gitweb/gitweb.cgi?p=.git;a=blobdiff;f=index.mdwn;h=0622da9b56b6a4f79388f3dc539d4c7d603ae4e9;hp=619d6d14eaf36b6bff80f7b68ce4f139fa0de9b2;hpb=000825c005ffc4c62279509119d80f1262023338

and displays the error message:

  • How to use git with ssh on github https repository addresses?
  • Trigger CI Build only on changes to subfolder in VSTS (was TFS Online), using Git
  • Using Keys with JGit to Access a Git Repository Securely
  • What's the meaning of `()` in git command SYNOPSIS?
  • git branch vs. git repository, which one should I use?
  • Unable to Git-add linux /dev devices with force
  • 404 Not Found – Missing one of the blob diff parameters

    However blob and commitdiff works.

    Any ideas how to fix this?

  • Git add and commit all files in one _native git_ command?
  • Appending history of one git repository to another
  • Forgot to push the commits
  • Reverting merge
  • How to Manually Deploy a Rails App with Git
  • Can git merge/pull detect when “local changes” are the same as an incoming merge conflict?
  • One Solution collect form web for “404 Not Found – Missing one of the blob diff parameters”

    Below is code snippet from newest source root/gitweb/gitweb.perl

    # preparing $fd and %diffinfo for git_patchset_body
    # new style URI
    if (defined $hash_base && defined $hash_parent_base) {
        if (defined $file_name) {
            # read raw output
            open $fd, "-|", git_cmd(), "diff-tree", '-r', @diff_opts,
                $hash_parent_base, $hash_base,
                "--", (defined $file_parent ? $file_parent : ()), $file_name
                or die_error(500, "Open git-diff-tree failed");
            @difftree = map { chomp; $_ } <$fd>;
            close $fd
                or die_error(404, "Reading git-diff-tree failed");
            @difftree
                or die_error(404, "Blob diff not found");
    
        } elsif (defined $hash &&
                 $hash =~ /[0-9a-fA-F]{40}/) {
            # try to find filename from $hash
    
            # read filtered raw output
            open $fd, "-|", git_cmd(), "diff-tree", '-r', @diff_opts,
                $hash_parent_base, $hash_base, "--"
                or die_error(500, "Open git-diff-tree failed");
            @difftree =
                # ':100644 100644 03b21826... 3b93d5e7... M    ls-files.c'
                # $hash == to_id
                grep { /^:[0-7]{6} [0-7]{6} [0-9a-fA-F]{40} $hash/ }
                map { chomp; $_ } <$fd>;
            close $fd
                or die_error(404, "Reading git-diff-tree failed");
            @difftree
                or die_error(404, "Blob diff not found");
    
        } else {
            die_error(400, "Missing one of the blob diff parameters");
        }
    
        if (@difftree > 1) {
            die_error(400, "Ambiguous blob diff specification");
        }
    
        %diffinfo = parse_difftree_raw_line($difftree[0]);
        $file_parent ||= $diffinfo{'from_file'} || $file_name;
        $file_name   ||= $diffinfo{'to_file'};
    
        $hash_parent ||= $diffinfo{'from_id'};
        $hash        ||= $diffinfo{'to_id'};
    
        # non-textual hash id's can be cached
        if ($hash_base =~ m/^[0-9a-fA-F]{40}$/ &&
            $hash_parent_base =~ m/^[0-9a-fA-F]{40}$/) {
            $expires = '+1d';
        }
    
        # open patch output
        open $fd, "-|", git_cmd(), "diff-tree", '-r', @diff_opts,
            '-p', ($format eq 'html' ? "--full-index" : ()),
            $hash_parent_base, $hash_base,
            "--", (defined $file_parent ? $file_parent : ()), $file_name
            or die_error(500, "Open git-diff-tree failed");
    }
    
    # old/legacy style URI
    if (!%diffinfo && # if new style URI failed
        defined $hash && defined $hash_parent) {
        # fake git-diff-tree raw output
        $diffinfo{'from_mode'} = $diffinfo{'to_mode'} = "blob";
        $diffinfo{'from_id'} = $hash_parent;
        $diffinfo{'to_id'}   = $hash;
        if (defined $file_name) {
            if (defined $file_parent) {
                $diffinfo{'status'} = '2';
                $diffinfo{'from_file'} = $file_parent;
                $diffinfo{'to_file'}   = $file_name;
            } else { # assume not renamed
                $diffinfo{'status'} = '1';
                $diffinfo{'from_file'} = $file_name;
                $diffinfo{'to_file'}   = $file_name;
            }
        } else { # no filename given
            $diffinfo{'status'} = '2';
            $diffinfo{'from_file'} = $hash_parent;
            $diffinfo{'to_file'}   = $hash;
        }
    
        # non-textual hash id's can be cached
        if ($hash =~ m/^[0-9a-fA-F]{40}$/ &&
            $hash_parent =~ m/^[0-9a-fA-F]{40}$/) {
            $expires = '+1d';
        }
    
        # open patch output
        open $fd, "-|", git_cmd(), "diff", @diff_opts,
            '-p', ($format eq 'html' ? "--full-index" : ()),
            $hash_parent, $hash, "--"
            or die_error(500, "Open git-diff failed");
    } else  {
        die_error(400, "Missing one of the blob diff parameters")
            unless %diffinfo;
    }
    

    And other code snippets (irrelevant codes are omitted) below are for parameter parsing:

    our $file_name = $cgi->param('f');
    our $hash = $cgi->param('h');
    our $hash_parent = $cgi->param('hp');
    our $hash_base = $cgi->param('hb');
    our $hash_parent_base = $cgi->param('hpb');
    

    Therefore the following is false:

    defined $hash_base 
    

    Unfortunately, these are all I got.
    From these codes above, the Exception is not expected.
    However, your gitweb may be not the newest. I suggest you check your sources.

    Git Baby is a git and github fan, let's start git clone.