list_phy_repos() moved from store.pm to common.pm
but you need to chdir() to the right place before calling it
This commit is contained in:
parent
00934c8304
commit
95c6952e11
|
@ -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)
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue