Gitweb – name of last person to commit

I’m looking to add the name of the person who made the last commit to each project on the GitWeb project list, so instead of

14 min ago

it says something like

  • Running a git server as CGI?
  • On Mac, where can I find git-http-backend?
  • Git authentication for perl CGI-Script via .netrc
  • Why won't this display the dynamic cgi?
  • Why are extra applications necessary for hosting Git via “smart HTTP” in IIS?
  • 14 min ago (Someone's Name)
    

    I’ve had a look through gitweb.cgi and found the point where the string is written (line 5488 in mine), but I don’t really know how to proceed.

    Has anyone already done this? Or can anyone offer a quick solution?

  • Make Git not track all branches
  • Why do I get “no url found for submodule path” by using sourcetree?
  • Can git do linear commit deltas during garbage collecton?
  • git error: failed to push some refs to
  • How to tag a git revision and then listing tagged revisions
  • Git: “propagate” rebase to other branches of the same root
  • One Solution collect form web for “Gitweb – name of last person to commit”

    Thanks to simbabque for pointing me to git_get_last_activity. My solution (possibly sub-optimal, let me know if it is):

    Change git_get_last_activity to

    sub git_get_last_activity {
    my ($path) = @_;
    my $fd;
    
    $git_dir = "$projectroot/$path";
    open($fd, "-|", git_cmd(), 'for-each-ref',
         '--format=%(committer)',
         '--sort=-committerdate',
         '--count=1',
         'refs/heads') or return;
    my $most_recent = <$fd>;
    close $fd or return;
    if (defined $most_recent &&
        $most_recent =~ / (\d+) [-+][01]\d\d\d$/) {
      my $bracket_position = rindex($most_recent, "<");
      my $committer_name = substr($most_recent, 0, $bracket_position - 1);
        my $timestamp = $1;
        my $age = time - $timestamp;
        return ($age, age_string($age), $committer_name);
    }
    return (undef, undef, undef);
    }
    

    Then search for where that is called later (should only be once) and change

    ($pr->{'age'}, $pr->{'age_string'}) = @activity;
    

    to be

    ($pr->{'age'}, $pr->{'age_string'}, $pr->{'committer'}) = @activity;
    

    Then go to git_project_list_rows and change

    (defined $pr->{'age_string'} ? $pr->{'age_string'} : "No commits") . "</td>\n" .
    

    to

    (defined $pr->{'age_string'} ? $pr->{'age_string'} . ' (' . $pr->{'committer'} . ')' : "No commits") . "</td>\n" .
    
    Git Baby is a git and github fan, let's start git clone.