about summary refs log tree commit homepage
path: root/script/public-inbox-index
diff options
context:
space:
mode:
authorEric Wong (Contractor, The Linux Foundation) <e@80x24.org>2018-03-19 08:14:50 +0000
committerEric Wong (Contractor, The Linux Foundation) <e@80x24.org>2018-03-19 08:16:34 +0000
commit84e2b6ab9805b93174c5387740bea592064c80ea (patch)
treeb58a5acbf5926b3bbc286412c93908057f6bc106 /script/public-inbox-index
parentfa53ccda7a0e4e975276ed421e7226393adb7ee8 (diff)
downloadpublic-inbox-84e2b6ab9805b93174c5387740bea592064c80ea.tar.gz
No functional changes, yet, but this makes future changes
easier-to-read.
Diffstat (limited to 'script/public-inbox-index')
-rwxr-xr-xscript/public-inbox-index12
1 files changed, 7 insertions, 5 deletions
diff --git a/script/public-inbox-index b/script/public-inbox-index
index 594a3d9c..1debbaac 100755
--- a/script/public-inbox-index
+++ b/script/public-inbox-index
@@ -4,13 +4,13 @@
 # Basic tool to create a Xapian search index for a git repository
 # configured for public-inbox.
 # Usage with libeatmydata <https://www.flamingspork.com/projects/libeatmydata/>
-# highly recommended: eatmydata public-inbox-index GIT_DIR
+# highly recommended: eatmydata public-inbox-index REPO_DIR
 
 use strict;
 use warnings;
 use Getopt::Long qw(:config gnu_getopt no_ignore_case auto_abbrev);
 use Cwd 'abs_path';
-my $usage = "public-inbox-index GIT_DIR";
+my $usage = "public-inbox-index REPO_DIR";
 use PublicInbox::Config;
 my $config = eval { PublicInbox::Config->new } || eval {
         warn "public-inbox unconfigured for serving, indexing anyways...\n";
@@ -28,8 +28,10 @@ GetOptions(%opts) or die "bad command-line args\n$usage";
 
 my @dirs;
 
-sub resolve_git_dir {
+sub resolve_repo_dir {
         my ($cd) = @_;
+        my $prefix = defined $cd ? $cd : './';
+
         my @cmd = qw(git rev-parse --git-dir);
         my $cmd = join(' ', @cmd);
         my $pid = open my $fh, '-|';
@@ -53,9 +55,9 @@ sub resolve_git_dir {
 }
 
 if (@ARGV) {
-        @dirs = map { resolve_git_dir($_) } @ARGV;
+        @dirs = map { resolve_repo_dir($_) } @ARGV;
 } else {
-        @dirs = (resolve_git_dir());
+        @dirs = (resolve_repo_dir());
 }
 
 sub usage { print STDERR "Usage: $usage\n"; exit 1 }