... | ... |
@@ -31,7 +31,20 @@ |
31 | 31 |
$content_type = 'application/x-git-packed-objects-toc'; |
32 | 32 |
} |
33 | 33 |
|
34 |
- $self->res->headers->content_type($content_type) if $content_type; |
|
35 |
- $self->render_static("../data/rep/$user/$project.git/$path"); |
|
36 |
- return; |
|
34 |
+ my $rep_home = app->git->rep_home; |
|
35 |
+ my $file = Mojo::Asset::File->new(path => "$rep_home/$user/$project.git/info/refs"); |
|
36 |
+ my $content = $file->slurp; |
|
37 |
+ if (defined $content) { |
|
38 |
+ $self->res->headers->content_type($content_type); |
|
39 |
+ $self->res->headers->content_length(length $content); |
|
40 |
+ $self->res->body($content); |
|
41 |
+ $self->res->code(200); |
|
42 |
+ $self->rendered; |
|
43 |
+ return; |
|
44 |
+ } |
|
45 |
+ else { |
|
46 |
+ $self->res->code(404); |
|
47 |
+ $self->rendered; |
|
48 |
+ return; |
|
49 |
+ } |
|
37 | 50 |
%> |
... | ... |
@@ -61,14 +61,14 @@ note 'Smart HTTP'; |
61 | 61 |
$t->get_ok("/kimoto/t1.git/info/refs"); |
62 | 62 |
$t->status_is(200); |
63 | 63 |
$t->content_type_is('text/plain; charset=UTF-8'); |
64 |
- |
|
65 |
-=pod |
|
64 |
+ |
|
65 |
+ my $object_id1 = substr($t->tx->res->body, 0, 2); |
|
66 |
+ my $object_id2 = substr($t->tx->res->body, 2, 38); |
|
67 |
+ |
|
66 | 68 |
# Loose object |
67 |
- $t->get_ok("/kimoto/t1.git/objects/20/42336f878dd054083193909140d1d10c16e775"); |
|
69 |
+ $t->get_ok("/kimoto/t1.git/objects/$object_id1/$object_id2"); |
|
68 | 70 |
$t->status_is(200); |
69 | 71 |
$t->content_type_is('application/x-git-loose-object'); |
70 |
-=cut |
|
71 | 72 |
|
72 |
- |
|
73 |
- |
|
74 |
-} |
|
73 |
+ |
|
74 |
+} |