about summary refs log tree commit homepage
path: root/script/public-inbox-convert
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2021-09-15 21:35:59 +0000
committerEric Wong <e@80x24.org>2021-09-15 23:14:55 +0000
commitadd90b9504f4217af5e35b3be7e326b8c6419647 (patch)
treea324dd2f4f36d849dff752fcadd2ba82e93e7297 /script/public-inbox-convert
parent5a5d2496f139e45823dbee3361ab790b2db4d31f (diff)
downloadpublic-inbox-add90b9504f4217af5e35b3be7e326b8c6419647.tar.gz
Because make(1), git(1), tar(1) all support -C in this form, as
do our newer commands such as lei, public-inbox-{clone,fetch}.
Diffstat (limited to 'script/public-inbox-convert')
-rwxr-xr-xscript/public-inbox-convert6
1 files changed, 3 insertions, 3 deletions
diff --git a/script/public-inbox-convert b/script/public-inbox-convert
index 01af846a..42955a48 100755
--- a/script/public-inbox-convert
+++ b/script/public-inbox-convert
@@ -33,7 +33,7 @@ my $opt = {
         quiet => -1, compact => 0, maxsize => undef, fsync => 1,
         reindex => 1, # we always reindex
 };
-GetOptions($opt, qw(jobs|j=i index! help|h),
+GetOptions($opt, qw(jobs|j=i index! help|h C=s@),
                 # index options
                 qw(verbose|v+ rethread compact|c+ fsync|sync!
                 indexlevel|index-level|L=s max_size|max-size=s
@@ -41,13 +41,14 @@ GetOptions($opt, qw(jobs|j=i index! help|h),
                 sequential-shard|seq-shard
                 )) or die $help;
 if ($opt->{help}) { print $help; exit 0 };
+require PublicInbox::Admin;
+PublicInbox::Admin::do_chdir(delete $opt->{C});
 my $old_dir = shift(@ARGV) // '';
 my $new_dir = shift(@ARGV) // '';
 die $help if (scalar(@ARGV) || $new_dir eq '' || $old_dir eq '');
 die "$new_dir exists\n" if -d $new_dir;
 die "$old_dir not a directory\n" unless -d $old_dir;
 
-require PublicInbox::Admin;
 require PublicInbox::Config;
 require PublicInbox::InboxWritable;
 
@@ -62,7 +63,6 @@ if (delete $old->{-unconfigured}) {
 }
 die "Only conversion from v1 inboxes is supported\n" if $old->version >= 2;
 
-require PublicInbox::Admin;
 my $detected = PublicInbox::Admin::detect_indexlevel($old);
 $old->{indexlevel} //= $detected;
 my $env;