diff --git a/Gitolite/Common.pm b/Gitolite/Common.pm index e5d492a..35a5c0f 100644 --- a/Gitolite/Common.pm +++ b/Gitolite/Common.pm @@ -6,7 +6,7 @@ package Gitolite::Common; #<<< @EXPORT = qw( print2 dbg _mkdir _open ln_sf tsh_rc sort_u - say _warn _chdir _print tsh_text + say _warn _chdir _print tsh_text list_phy_repos say2 _die slurp tsh_lines trace tsh_try usage tsh_run @@ -142,6 +142,26 @@ sub sort_u { my @sort_u = sort keys %uniq; return \@sort_u; } + +{ + my @phy_repos = (); + + sub list_phy_repos { + trace(3); + + # use cached value only if it exists *and* no arg was received (i.e., + # receiving *any* arg invalidates cache) + return \@phy_repos if ( @phy_repos and not @_ ); + + for my $repo (`find . -name "*.git" -prune`) { + chomp($repo); + $repo =~ s(\./(.*)\.git$)($1); + push @phy_repos, $repo; + } + return sort_u(\@phy_repos); + } +} + # ---------------------------------------------------------------------- # bare-minimum subset of 'Tsh' (see github.com/sitaramc/tsh) diff --git a/Gitolite/Conf/Store.pm b/Gitolite/Conf/Store.pm index 69056a0..518a750 100644 --- a/Gitolite/Conf/Store.pm +++ b/Gitolite/Conf/Store.pm @@ -195,10 +195,10 @@ sub store { trace(3); # first write out the ones for the physical repos - my @phy_repos = list_physical_repos(1); - _chdir($GL_REPO_BASE); - for my $repo (@phy_repos) { + my $phy_repos = list_phy_repos(1); + + for my $repo (@{ $phy_repos }) { store_1($repo); } @@ -228,26 +228,6 @@ sub check_subconf_repo_disallowed { return 1; } -{ - my @phy_repos = (); - - sub list_physical_repos { - trace(3); - _chdir($GL_REPO_BASE); - - # use cached value only if it exists *and* no arg was received (i.e., - # receiving *any* arg invalidates cache) - return @phy_repos if ( @phy_repos and not @_ ); - - for my $repo (`find . -name "*.git" -prune`) { - chomp($repo); - $repo =~ s(\./(.*)\.git$)($1); - push @phy_repos, $repo; - } - return @phy_repos; - } -} - sub store_1 { # warning: writes and *deletes* it from %repos and %configs my ($repo) = shift;