Showing 2 changed files with 26 additions and 14 deletions
+17 -8
lib/Gitprep/Git.pm
... ...
@@ -977,18 +977,27 @@ sub parse_commit_text {
977 977
 }
978 978
 
979 979
 sub parse_commits {
980
-  my ($self, $project, $cid, $maxcount, $skip, $file, @args) = @_;
980
+  my ($self, $user, $project, $cid, $maxcount, $skip, $file, @args) = @_;
981 981
 
982
-  # git rev-list
982
+  # Get Commits
983 983
   $maxcount ||= 1;
984 984
   $skip ||= 0;
985
-  my @cmd = ($self->cmd($project), 'rev-list', '--header', @args,
986
-    ('--max-count=' . $maxcount), ('--skip=' . $skip), $cid, '--',
987
-    (defined $file ? ($file) : ()));
985
+  my @cmd = $self->_cmd(
986
+    $user,
987
+    $project,
988
+    'rev-list',
989
+    '--header',
990
+    @args,
991
+    ('--max-count=' . $maxcount),
992
+    ('--skip=' . $skip),
993
+    $cid,
994
+    '--',
995
+    (defined $file ? ($file) : ())
996
+  );
988 997
   open my $fh, '-|', @cmd
989 998
     or croak 'Open git-rev-list failed';
990
-
991
-  # Parse rev-list results
999
+  
1000
+  # Prase Commits text
992 1001
   local $/ = "\0";
993 1002
   my @commits;
994 1003
   while (my $line = $self->dec(scalar <$fh>)) {
... ...
@@ -996,7 +1005,7 @@ sub parse_commits {
996 1005
     push @commits, $commit;
997 1006
   }
998 1007
   close $fh;
999
-
1008
+  
1000 1009
   return \@commits;
1001 1010
 }
1002 1011
 
+9 -6
templates/main/commits.html.ep
... ...
@@ -1,6 +1,6 @@
1 1
 <%
2 2
   # API
3
-  my $api = Gitprep::API->new($self);
3
+  my $api = gitprep_api;
4 4
 
5 5
   # Parameters
6 6
   my $user = param('user');
... ...
@@ -8,20 +8,23 @@
8 8
   my $rev = param('rev');
9 9
   my $blob = param('blob');
10 10
   my $page = param('page') || 0;
11
-  my $root_ns = $api->root_ns(config->{root});
12
-  my $rep_ns = "$root_ns/$user/$project.git";
13
-  my $rep = "/$rep_ns";
14 11
   
15 12
   # Git
16 13
   my $git = $self->app->git;
17 14
   
18 15
   # Commit
19
-  my $commit = $git->parse_commit($rep, $rev);
16
+  my $commit = $git->parse_commit($user, $project, $rev);
20 17
   
21 18
   # Commits
22 19
   my $page_count = 30;
23 20
   my $commits = $git->parse_commits(
24
-    $rep, $commit->{id}, $page_count, $page_count * $page, $blob);
21
+    $user,
22
+    $project,
23
+    $commit->{id},
24
+    $page_count,
25
+    $page_count * $page,
26
+    $blob
27
+  );
25 28
   my $commits_count = @$commits;
26 29
   my $commits_date = {};
27 30
   for my $commit (@$commits) {