From: Vincent Pit <vince@profvince.com>
Date: Mon, 6 Oct 2008 14:19:26 +0000 (+0200)
Subject: Don't store the repos in the command, so that no search happen for Once commands
X-Git-Tag: v0.03~11
X-Git-Url: http://git.vpit.fr/?a=commitdiff_plain;h=6106b02a51da37eadcc29155ae4d51c07fff61ce;p=perl%2Fmodules%2Frgit.git

Don't store the repos in the command, so that no search happen for Once commands
---

diff --git a/lib/App/Rgit.pm b/lib/App/Rgit.pm
index 1d1ee0f..38e4c38 100644
--- a/lib/App/Rgit.pm
+++ b/lib/App/Rgit.pm
@@ -42,13 +42,14 @@ sub new {
   git  => $args{git},
  );
  return unless defined $config;
+ my $command = App::Rgit::Command->new(
+  cmd  => $args{cmd},
+  args => $args{args},
+ );
+ return unless defined $command;
  $class->SUPER::new(
   config  => $config,
-  command => App::Rgit::Command->new(
-   cmd   => $args{cmd},
-   args  => $args{args},
-   repos => $config->repos,
-  )
+  command => $command,
  );
 }
 
diff --git a/lib/App/Rgit/Command.pm b/lib/App/Rgit/Command.pm
index 51ac158..a73c9b4 100644
--- a/lib/App/Rgit/Command.pm
+++ b/lib/App/Rgit/Command.pm
@@ -5,7 +5,7 @@ use warnings;
 
 use Carp qw/croak/;
 
-use Object::Tiny qw/cmd cwd_as_repo args repos/;
+use Object::Tiny qw/cmd cwd_as_repo args/;
 
 use App::Rgit::Utils qw/validate/;
 use App::Rgit::Repository;
@@ -30,9 +30,9 @@ This is an internal class to L<rgit>.
 
 =head1 METHODS
 
-=head2 C<< new cmd => $cmd, args => \@args, repos => \@repos >>
+=head2 C<< new cmd => $cmd, args => \@args >>
 
-Creates a new command object for C<$cmd> that will called for all repositories C<@repos> with arguments C<@args>.
+Creates a new command object for C<$cmd> that is bound to be called with arguments C<@args>.
 
 =cut
 
@@ -56,7 +56,6 @@ sub new {
  $class->SUPER::new(
   cmd         => $cmd,
   args        => $args{args} || [ ],
-  repos       => $args{repos},
   cwd_as_repo => $r,
  );
 }
@@ -88,8 +87,6 @@ sub action {
 
 =head2 C<args>
 
-=head2 C<repos>
-
 Accessors.
 
 =head2 C<run $conf>
diff --git a/lib/App/Rgit/Command/Each.pm b/lib/App/Rgit/Command/Each.pm
index 155e974..2825ef6 100644
--- a/lib/App/Rgit/Command/Each.pm
+++ b/lib/App/Rgit/Command/Each.pm
@@ -35,10 +35,11 @@ It implements :
 
 sub run {
  my $self = shift;
+ my $conf = shift;
  my $status = 0;
- for (@{$self->repos}) {
+ for (@{$conf->repos}) {
   $_->chdir or next;
-  $status = $_->run($_[0], @{$self->args});
+  $status = $_->run($conf, @{$self->args});
   last if $status;
  }
  $self->cwd_as_repo->chdir;