From: Vincent Pit Date: Tue, 23 Feb 2010 14:11:07 +0000 (+0100) Subject: Don't chdir() when searching for git repositories X-Git-Tag: v0.07~24 X-Git-Url: http://git.vpit.fr/?a=commitdiff_plain;h=c4df0499041f9632e0b0bdfcf563b28565b503d0;p=perl%2Fmodules%2Frgit.git Don't chdir() when searching for git repositories Also don't search in non-readable directories. --- diff --git a/lib/App/Rgit/Config/Default.pm b/lib/App/Rgit/Config/Default.pm index 1472418..028e106 100644 --- a/lib/App/Rgit/Config/Default.pm +++ b/lib/App/Rgit/Config/Default.pm @@ -43,12 +43,14 @@ sub repos { my %repos; find { wanted => sub { - return unless -d $_; - my $r = App::Rgit::Repository->new(dir => $File::Find::name); + return if m{(?:^|/)\.\.?$} + or not (-d $_ and -r _); + my $r = App::Rgit::Repository->new(dir => $_); $repos{$r->repo} = $r if $r and not exists $repos{$r->repo}; }, - follow => 1 + follow => 1, + no_chdir => 1, }, $self->root; $self->{repos} = [ sort { $a->repo cmp $b->repo } values %repos ]; }