lib/PublicInbox/LEI.pm | 6 ++++++ diff --git a/lib/PublicInbox/LEI.pm b/lib/PublicInbox/LEI.pm index 59a3338c08a69a9415190546b122d06bc14eff3f..31d5b838e7b66c44d4612d5b8dbb598950a86f22 100644 --- a/lib/PublicInbox/LEI.pm +++ b/lib/PublicInbox/LEI.pm @@ -606,8 +606,10 @@ my ($self, $creat) = @_; my $f = _config_path($self); my @st = stat($f); my $cur_st = @st ? pack('dd', $st[10], $st[7]) : ''; # 10:ctime, 7:size + my ($sto, $sto_dir); if (my $cfg = $PATH2CFG{$f}) { # reuse existing object in common case return ($self->{cfg} = $cfg) if $cur_st eq $cfg->{-st}; + ($sto, $sto_dir) = @$cfg{qw(-lei_store leistore.dir)}; } if (!@st) { unless ($creat) { @@ -625,6 +627,10 @@ my $cfg = PublicInbox::Config::git_config_dump($f); bless $cfg, 'PublicInbox::Config'; $cfg->{-st} = $cur_st; $cfg->{'-f'} = $f; + if ($sto && File::Spec->canonpath($sto_dir) eq + File::Spec->canonpath($cfg->{'leistore.dir'})) { + $cfg->{-lei_store} = $sto; + } $self->{cfg} = $PATH2CFG{$f} = $cfg; }