<% # 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->render_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/project_header'; %= include '/include/code_menu', display => 'commits';
% if ($commit->{title_short} eq $commit->{title}) { <%= $commit->{title_short} %>; % } else { <% my $title_short = $commit->{title_short}; $title_short =~ s/\.\.\.\s*$//; my $title_tail = $commit->{title}; $title_tail =~ s/^\Q$title_short//; $title_tail =~ s/^\s+//; %>

<%= $title_short %>...

...<%= $title_tail %>

% }
% if (@{$commit->{comment}} > 1) {
% for (my $i = 1; $i < @{$commit->{comment}}; $i++) {
<%= $commit->{comment}[$i] %>
% }
% } % if (@$branches || @$tags) {
% for my $branch (@$branches) { "><%= $branch %> % } % for my $tag (@$tags) { "><%= $tag %> % }
% }
<%= $commit->{author_name} %> authored <%= $commit->{age_string} %>
% my $parents = $commit->{parents}; % if (@$parents == 0) {
0 parent commit <%= $commit->{id} %>
% } elsif (@$parents == 1) {
1 parent [0]") %>"> <%= substr($parents->[0], 0, 7) %> commit <%= $commit->{id} %>
% } else {
commit <%= $commit->{id} %>
2 parents: [0]") %>"> <%= substr($parents->[0], 0, 7) %> + [1]") %>"> <%= substr($parents->[1], 0, 7) %>
% }
%= include '/include/commit_body'; %= include '/include/footer';