user/dev discussion of public-inbox itself
 help / color / mirror / code / Atom feed
From: Eric Wong <e@80x24.org>
To: meta@public-inbox.org
Subject: [PATCH 4/6] extindex: do not use current dir like -index does
Date: Tue,  8 Dec 2020 21:21:28 +0000	[thread overview]
Message-ID: <20201208212130.5832-5-e@80x24.org> (raw)
In-Reply-To: <20201208212130.5832-1-e@80x24.org>

At least not for resolving inboxes, since there's no good way
for a user to specify what is an inbox or extindex directory
without a command-line switch.

Instead of changing the -extindex command, we change the -index
command internals to rely on the new {-use_cwd} flag to avoid
internal use of negation, since double-negatives and the like
are confusing to me.
---
 lib/PublicInbox/Admin.pm  | 2 +-
 script/public-inbox-index | 1 +
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/lib/PublicInbox/Admin.pm b/lib/PublicInbox/Admin.pm
index 9d48e5eb..ec80b565 100644
--- a/lib/PublicInbox/Admin.pm
+++ b/lib/PublicInbox/Admin.pm
@@ -118,7 +118,7 @@ EOF
 	} else { # directories specified on the command-line
 		my $i = 0;
 		my @dirs = @$argv;
-		push @dirs, '.' unless @dirs;
+		push @dirs, '.' if !@dirs && $opt->{-use_cwd};
 		foreach (@dirs) {
 			my $v;
 			my $dir = resolve_repo_dir($_, \$v);
diff --git a/script/public-inbox-index b/script/public-inbox-index
index 5909801e..8a61817c 100755
--- a/script/public-inbox-index
+++ b/script/public-inbox-index
@@ -51,6 +51,7 @@ require PublicInbox::Admin;
 PublicInbox::Admin::require_or_die('-index');
 
 my $cfg = PublicInbox::Config->new; # Config is loaded by Admin
+$opt->{-use_cwd} = 1;
 my @ibxs = PublicInbox::Admin::resolve_inboxes(\@ARGV, $opt, $cfg);
 PublicInbox::Admin::require_or_die('-index');
 unless (@ibxs) { print STDERR $help; exit 1 }

  parent reply	other threads:[~2020-12-08 21:21 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-08 21:21 [PATCH 0/6] minor internal consistency things Eric Wong
2020-12-08 21:21 ` [PATCH 1/6] treewide: replace {-inbox} with {ibx} for consistency Eric Wong
2020-12-08 21:21 ` [PATCH 2/6] nntp: replace {ng} " Eric Wong
2020-12-08 21:21 ` [PATCH 3/6] rename {pi_config} fields to {pi_cfg} Eric Wong
2020-12-08 21:21 ` Eric Wong [this message]
2020-12-08 21:21 ` [PATCH 5/6] admin: resolve_repo_dir => resolve_inboxdir Eric Wong
2020-12-08 21:21 ` [PATCH 6/6] extsearchidx: ck_existing: set $OID for warning context Eric Wong

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://public-inbox.org/README

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201208212130.5832-5-e@80x24.org \
    --to=e@80x24.org \
    --cc=meta@public-inbox.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/public-inbox.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).