<% # API my $api = gitprep_api; # Paramters my $user_id = param('user'); my $project_id = param('project'); my $diff = param('diff'); my ($from_rev, $rev) = $diff =~ /(.+)\.\.(.+)/; $rev = $diff unless defined $rev; # Git my $git = app->git; # Commit my $commit = $git->get_commit(app->rep_info($user_id, $project_id), $rev); unless ($commit) { $self->reply->not_found; return; } my $author_date = $git->parse_date($commit->{author_epoch}, $commit->{author_tz}); my $committer_date = $git->parse_date($commit->{committer_epoch}, $commit->{committer_tz}); $commit->{author_date} = $git->timestamp($author_date); $commit->{committer_date} = $git->timestamp($committer_date); $from_rev = $commit->{parent} unless defined $from_rev; my $commit_short_id = substr($commit->{id}, 0, 7, ); my $commit_author_email = $commit->{author_email}; my $commit_author_id = app->dbi->model('user')->select( 'id', where => {email => $commit_author_email} )->value; # Branches my $branch_refs = $git->references(app->rep_info($user_id, $project_id), 'heads'); my $branches = $branch_refs->{$commit->{id}} || []; # Tags my $tag_refs = $git->references(app->rep_info($user_id, $project_id), 'tags'); my $tags = $tag_refs->{$commit->{id}} || []; # commit_body args my %commit_body_args = ( user => $user_id, project => $project_id, rev => $rev, from_rev => $from_rev ); layout 'common', title => "$commit->{title_short} \x{30fb} $commit_short_id"; %> %= include '/include/header';
%= include '/include/commit_body', %commit_body_args;
%= include '/include/footer';