chdirs moved from load() to load_common() and load_1()

This commit is contained in:
Sitaram Chamarty 2012-03-08 12:31:01 +05:30
parent 60e190215e
commit b0ceac2594

View file

@ -43,8 +43,8 @@ my $last_repo = '';
trace( 4, "$repo" ); trace( 4, "$repo" );
if ( $repo ne $loaded_repo ) { if ( $repo ne $loaded_repo ) {
trace( 3, "loading $repo..." ); trace( 3, "loading $repo..." );
_chdir("$GL_ADMIN_BASE"); load_common(); load_common();
_chdir("$GL_REPO_BASE"); load_1($repo); load_1($repo);
$loaded_repo = $repo; $loaded_repo = $repo;
} }
} }
@ -86,6 +86,8 @@ sub access {
sub load_common { sub load_common {
_chdir("$GL_ADMIN_BASE");
# we take an unusual approach to caching this function! # we take an unusual approach to caching this function!
# (requires that first call to load_common is before first call to load_1) # (requires that first call to load_common is before first call to load_1)
if ( $last_repo and $split_conf{$last_repo} ) { if ( $last_repo and $split_conf{$last_repo} ) {
@ -110,6 +112,8 @@ sub load_1 {
my $repo = shift; my $repo = shift;
trace( 4, $repo ); trace( 4, $repo );
_chdir("$GL_REPO_BASE");
if ( $repo eq $last_repo ) { if ( $repo eq $last_repo ) {
$repos{$repo} = $one_repo{$repo}; $repos{$repo} = $one_repo{$repo};
$configs{$repo} = $one_config{$repo} if $one_config{$repo}; $configs{$repo} = $one_config{$repo} if $one_config{$repo};