Showing 1 changed files with 16 additions and 15 deletions
+16 -15
lib/Gitprep/Git.pm
... ...
@@ -542,7 +542,7 @@ sub path_by_id {
542 542
 sub project_description {
543 543
   my ($self, $project) = @_;
544 544
   
545
-  # Description
545
+  # Project Description
546 546
   my $file = "$project/description";
547 547
   my $description = $self->_slurp($file) || '';
548 548
   
... ...
@@ -640,25 +640,26 @@ sub projects {
640 640
   opendir my $dh, $self->enc($dir)
641 641
     or croak qq/Can't open directory $dir: $!/;
642 642
   my @reps;
643
-  while (my $rep = readdir $dh) {
644
-    next unless $rep =~ /\.git$/;
645
-    my $rep_name = $rep;
646
-    $rep_name =~ s/\.git$//;
647
-    push @reps, { name => $rep_name, path => $rep };
648
-  }
649
-
650
-  # Fill repositroies information
651
-  for my $rep (@reps) {
652
-    my @activity = $self->last_activity("$dir/$rep->{path}");
643
+  while (my $rep_name = readdir $dh) {
644
+    next unless $rep_name =~ /\.git$/;
645
+    my $project = $rep_name;
646
+    $project =~ s/\.git$//;
647
+    my $rep_path = "$home/$user/$rep_name";
648
+    my @activity = $self->last_activity($rep_path);
653 649
     
650
+    my $rep = {};
651
+    $rep->{name} = $project;
654 652
     if (@activity) {
655
-      ($rep->{age}, $rep->{age_string}) = @activity;
653
+      $rep->{age} = $activity[0];
654
+      $rep->{age_string} = $activity[1];
656 655
     }
657
-
658
-    my $description = $self->project_description("$dir/$rep->{path}") || '';
656
+    
657
+    my $description = $self->project_description($rep_path) || '';
659 658
     $rep->{description} = $self->_chop_str($description, 25, 5);
659
+    
660
+    push @reps, $rep;
660 661
   }
661
-
662
+  
662 663
   return \@reps;
663 664
 }
664 665