add submodule support
|
1 |
<% |
2 |
use File::Basename (); |
|
3 |
|
|
4 |
# API |
|
5 |
my $api = gitprep_api; |
|
6 | ||
7 |
# Git |
|
revert encoding support
|
8 |
my $git = $self->app->git; |
add submodule support
|
9 |
|
10 |
# Parameters |
|
11 |
my $user = param('user'); |
|
12 |
my $project = param('project'); |
|
13 |
my $rev_file = param('rev_file'); |
|
cleanup parse_rev_path
|
14 |
my ($rev, $file) = $git->parse_rev_path(app->rep_info($user, $project), $rev_file); |
add submodule support
|
15 |
my $file_base = File::Basename::basename $file; |
16 | ||
17 |
# Blob lines |
|
cleanup rep_info
|
18 |
my $lines = $git->blob(app->rep_info($user, $project), $rev, '.gitmodules'); |
cleanup blob
|
19 |
|
add submodule support
|
20 |
my $submodule_rep_url; |
21 |
my $match; |
|
22 |
my $file_q = quotemeta $file; |
|
23 |
for my $line (@$lines) { |
|
24 |
$line =~ s/\r//; |
|
25 |
$line =~ s/\n//; |
|
26 |
|
|
27 |
if ($match) { |
|
28 |
if ($line =~ /url += +(.+)/) { |
|
29 |
$submodule_rep_url = $1; |
|
30 |
last; |
|
31 |
} |
|
32 |
} |
|
33 |
elsif ($line =~ /path += +$file_q( +|$)/) { |
|
34 |
$match = 1; |
|
35 |
}; |
|
36 |
} |
|
37 | ||
38 |
# Variables for included template |
|
improve submodule design
|
39 |
stash id => $rev; |
40 |
stash project => $project; |
|
41 |
stash rev => $rev; |
|
42 | ||
43 |
layout 'common' , title => "$project/$file at $rev \x{30fb} $user/$project"; |
|
add submodule support
|
44 |
%> |
45 | ||
46 |
%= include '/include/header'; |
|
47 | ||
48 |
<div class="container"> |
|
49 |
%= include '/include/page_path', type => 'blob', Path => $file; |
|
improve submodule design
|
50 |
|
51 |
<div class="submodule"> |
|
52 |
<div> |
|
53 |
<div> |
|
54 |
<div> |
|
55 |
<%= $file_base %> <small>[submodule]</small> |
|
56 |
</div> |
|
add submodule support
|
57 |
</div> |
58 |
</div> |
|
improve submodule design
|
59 |
<div class="last-child"> |
60 |
% if ($submodule_rep_url) { |
|
61 |
% if ($submodule_rep_url =~ /^http/) { |
|
62 |
<a href="<%= $submodule_rep_url %>"><%= $submodule_rep_url %></a> |
|
63 |
% } else { |
|
64 |
<%= $submodule_rep_url %> |
|
65 |
% } |
|
add submodule support
|
66 |
% } |
improve submodule design
|
67 |
</div> |
add submodule support
|
68 |
</div> |
69 |
</div> |
|
70 |
|
|
71 |
%= include '/include/footer'; |