<% # API my $api = gitprep_api; # Paramters my $project = 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($user, $project, $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, ); # Branches my $branch_refs = $git->references($user, $project, 'heads'); my $branches = $branch_refs->{$commit->{id}} || []; # Tags my $tag_refs = $git->references($user, $project, 'tags'); my $tags = $tag_refs->{$commit->{id}} || []; # Global variable for included template stash( rev => $rev, from_rev => $from_rev, commit => $commit, parents => $commit->{parents} ); layout 'common', title => "$commit->{title_short} \x{30fb} $commit_short_id"; %> %= include '/include/header';
%= include '/include/commit_body';
%= include '/include/footer';