about summary refs log tree commit homepage
path: root/scripts
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2015-01-11 23:58:55 +0000
committerEric Wong <e@80x24.org>2015-01-11 23:58:55 +0000
commit8cd7dbc96254f6c19990fc28c266e274cc80ddfb (patch)
tree1a7b8680c9de0e95fbb358b8cc6496a01fec0265 /scripts
parent5a5b285567528d52860cfd971ff808c75158155e (diff)
downloadpublic-inbox-8cd7dbc96254f6c19990fc28c266e274cc80ddfb.tar.gz
PublicInbox::Config->lookup won't return unknown keys
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/import_slrnspool20
1 files changed, 16 insertions, 4 deletions
diff --git a/scripts/import_slrnspool b/scripts/import_slrnspool
index d95836d6..e55c96c7 100755
--- a/scripts/import_slrnspool
+++ b/scripts/import_slrnspool
@@ -31,16 +31,28 @@ if ($ENV{'FILTER'}) {
         @mda = (qw(ssoma-mda -1), $cfg->{mainrepo});
 }
 
-sub get_min {
+sub key {
         my ($cfg) = @_;
-        $cfg->{importslrnspoolstate} || 0;
+        "publicinbox.$cfg->{listname}.importslrnspoolstate";
+}
+
+sub get_min {
+        my $f = PublicInbox::Config->default_file;
+        my @cmd = (qw/git config/, "--file=$f", key($cfg));
+        use IPC::Run qw/run/;
+
+        my $in = '';
+        my $out = '';
+        unless (run(\@cmd, \$in, \$out)) {
+                $out = 0;
+        }
+        int($out);
 }
 
 sub set_min {
         my ($cfg, $num) = @_;
         my $f = PublicInbox::Config->default_file;
-        my @cmd = (qw/git config/, "--file=$f",
-                   "publicinbox.$cfg->{listname}.importslrnspoolstate", $num);
+        my @cmd = (qw/git config/, "--file=$f", key($cfg), $num);
         system(@cmd) == 0 or die join(' ', @cmd). " failed: $?\n";
 }