... | ... |
@@ -89,7 +89,7 @@ sub startup { |
89 | 89 |
$r->get('/blobdiff/(#diff)/(*file)')->to('#blobdiff'); |
90 | 90 |
|
91 | 91 |
# Raw |
92 |
- $r->get('/raw/(*id_file)')->to('#raw'); |
|
92 |
+ $r->get('/raw/(*object)')->to('#raw'); |
|
93 | 93 |
|
94 | 94 |
# Archive |
95 | 95 |
$r->get('/archive/(#rev).tar.gz')->to('#archive', archive_type => 'tar'); |
... | ... |
@@ -2,28 +2,26 @@ |
2 | 2 |
# API |
3 | 3 |
my $api = Gitprep::API->new($self); |
4 | 4 |
|
5 |
+ # Parameters |
|
5 | 6 |
my $user = param('user'); |
6 | 7 |
my $project = param('project'); |
7 | 8 |
my $root_ns = $api->root_ns(config->{root}); |
8 |
- |
|
9 |
- # Parameters |
|
10 | 9 |
my $rep_ns = "$root_ns/$user/$project.git"; |
11 | 10 |
my $rep = "/$rep_ns"; |
12 |
- my $home_ns = $api->dirname($rep_ns); |
|
13 |
- my $home = "/$home_ns"; |
|
14 | 11 |
my $object = param('object'); |
15 | 12 |
|
16 | 13 |
# Git |
17 | 14 |
my $git = $self->app->git; |
18 | 15 |
|
19 | 16 |
# Id and file |
20 |
- my ($id, $file) = $git->parse_object($rep, $object); |
|
17 |
+ use D;d [$rep, $object]; |
|
18 |
+ my ($rev, $file) = $git->parse_object($rep, $object); |
|
21 | 19 |
|
22 | 20 |
# Commit |
23 |
- my $commit_log = $git->latest_commit_log($rep, $id, $file); |
|
21 |
+ my $commit_log = $git->latest_commit_log($rep, $rev, $file); |
|
24 | 22 |
|
25 | 23 |
# Blob content |
26 |
- my $bid = $git->id_by_path($rep, $id, $file, 'blob') |
|
24 |
+ my $bid = $git->id_by_path($rep, $rev, $file, 'blob') |
|
27 | 25 |
or $api->croak('Cannot find file'); |
28 | 26 |
my @cmd = ($git->cmd($rep), 'cat-file', 'blob', $bid); |
29 | 27 |
open my $fh, '-|', @cmd |
... | ... |
@@ -48,7 +46,7 @@ |
48 | 46 |
} |
49 | 47 |
|
50 | 48 |
# File name |
51 |
- my $file_name = $id; |
|
49 |
+ my $file_name = $rev; |
|
52 | 50 |
if (defined $file) { $file_name = $file } |
53 | 51 |
elsif ($type =~ m/^text\//) { $file_name .= '.txt' } |
54 | 52 |
|