Showing 6 changed files with 18 additions and 18 deletions
+11 -11
lib/Gitprep/Git.pm
... ...
@@ -547,22 +547,22 @@ sub commits_number {
547 547
 }
548 548
 
549 549
 sub exists_branch {
550
-  my ($self, $user, $project) = @_;
550
+  my ($self, $rep) = @_;
551 551
   
552 552
   # Exists branch
553
-  my @cmd = $self->cmd_rep($user, $project, 'branch');
553
+  my @cmd = $self->cmd($rep, 'branch');
554 554
   open my $fh, "-|", @cmd
555 555
     or croak 'git branch failed';
556 556
   local $/;
557
-  my $branches = <$fh>;
557
+  my $branch = <$fh>;
558 558
   
559
-  return $branches ne '' ? 1 : 0;
559
+  return $branch ne '' ? 1 : 0;
560 560
 }
561 561
 
562 562
 sub delete_branch {
563
-  my ($self, $user, $project, $branch) = @_;
563
+  my ($self, $rep, $branch) = @_;
564 564
   
565
-  my $branches = $self->branches($self->app->rep_info($user, $project));
565
+  my $branches = $self->branches($rep);
566 566
   my $exists;
567 567
   for my $b (@$branches) {
568 568
     if ($branch eq $b->{name}) {
... ...
@@ -572,7 +572,7 @@ sub delete_branch {
572 572
   }
573 573
   
574 574
   if ($exists) {
575
-    my @cmd = $self->cmd_rep($user, $project, 'branch', '-D', $branch);
575
+    my @cmd = $self->cmd($rep, 'branch', '-D', $branch);
576 576
     Gitprep::Util::run_command(@cmd)
577 577
       or croak "Branch deleting failed. Can't delete branch $branch";
578 578
   }
... ...
@@ -582,10 +582,10 @@ sub delete_branch {
582 582
 }
583 583
 
584 584
 sub description {
585
-  my ($self, $user, $project, $description) = @_;
585
+  my ($self, $rep, $description) = @_;
586 586
   
587
-  my $rep = $self->app->rep_path($user, $project);
588
-  my $file = "$rep/description";
587
+  my $git_dir = $rep->{git_dir};
588
+  my $file = "$git_dir/description";
589 589
   
590 590
   if (defined $description) {
591 591
     # Write description
... ...
@@ -914,7 +914,7 @@ sub repository {
914 914
   }
915 915
   else { $rep->{age} = 0 }
916 916
   
917
-  my $description = $self->description($user, $project) || '';
917
+  my $description = $self->description($self->app->rep_info($user, $project)) || '';
918 918
   $rep->{description} = $self->_chop_str($description, 25, 5);
919 919
   
920 920
   return $rep;
+1 -1
script/import_rep
... ...
@@ -82,7 +82,7 @@ for my $rep (glob "$rep_dir/*") {
82 82
       }
83 83
     };
84 84
     $description = decode('UTF-8', $description);
85
-    eval {$git->description($user, $project, $description) };
85
+    eval {$git->description(app->rep_info($user, $project), $description) };
86 86
     if ($@) {
87 87
       warn "Can't update description $project\n";
88 88
     }
+1 -1
templates/auto/_search.html.ep
... ...
@@ -112,7 +112,7 @@
112 112
                   my $user = $project->{user_id};
113 113
                   my $project = $project->{name};
114 114
                   my $rev = app->manager->default_branch($user, $project);
115
-                  my $desc = app->git->description($user, $project);
115
+                  my $desc = app->git->description(app->rep_info($user, $project));
116 116
                   my $branches = app->git->branches($self->app->rep_info($user, $project));
117 117
                   my $commit;
118 118
                   if (@$branches) {
+1 -1
templates/branches.html.ep
... ...
@@ -39,7 +39,7 @@
39 39
 
40 40
     if ($validation->is_valid) {
41 41
       # Delete branch
42
-      eval { $git->delete_branch($user, $project, $branch) };
42
+      eval { $git->delete_branch(app->rep_info($user, $project), $branch) };
43 43
       if (my $e = $@) {
44 44
         app->log->error(url_with . ": $e");
45 45
         $errors = ['Internal Error'];
+2 -2
templates/settings.html.ep
... ...
@@ -60,7 +60,7 @@
60 60
       my $description = param('description');
61 61
       $description = '' unless defined $description;
62 62
       
63
-      eval { $git->description($user, $project, $description) };
63
+      eval { $git->description(app->rep_info($user, $project), $description) };
64 64
       if (my $e = $@) {
65 65
         app->log->error("/$user/$project/settings?op=description: $e");
66 66
         $errors = ['Internal Error'];
... ...
@@ -209,7 +209,7 @@
209 209
           <li>
210 210
             <form action="<%= url_for->query(op => 'change-description') %>" method="post">
211 211
               <div>
212
-                % my $description = $git->description($user, $project);
212
+                % my $description = $git->description(app->rep_info($user, $project));
213 213
                 % $description = '' unless defined $description;
214 214
                 %= text_field 'description' => $description, style => "width:90%";
215 215
                 <input type="submit" class="btn" value="Save">
+2 -2
templates/tree.html.ep
... ...
@@ -29,11 +29,11 @@
29 29
   }
30 30
 
31 31
   # Repository description
32
-  my $desc = $git->description($user, $project);
32
+  my $desc = $git->description(app->rep_info($user, $project));
33 33
   
34 34
   # Check exsitence
35 35
   my $commits_number;
36
-  if ($git->exists_branch($user, $project)) {
36
+  if ($git->exists_branch(app->rep_info($user, $project))) {
37 37
     # Commit
38 38
     my $commit = $git->get_commit($user, $project, $rev);
39 39