about summary refs log tree commit homepage
path: root/lib/PublicInbox/Import.pm
diff options
context:
space:
mode:
authorEric Wong <e@yhbt.net>2020-04-19 23:19:34 +0000
committerEric Wong <e@yhbt.net>2020-04-20 20:18:16 +0000
commitd55abcc42bde846d9047491125dd2b32645dafd8 (patch)
treea7dd9274b4790732aaa401757490919d3e8296b7 /lib/PublicInbox/Import.pm
parentb3a04ae18a42ed960c89cc81c209633da6976380 (diff)
downloadpublic-inbox-d55abcc42bde846d9047491125dd2b32645dafd8.tar.gz
Allowing ->init_bare to be used as a method saves some
keystrokes, and we can save a little bit of time on systems with
our vfork(2)-enabled spawn().

This also sets us up for future improvements where we can
avoid spawning a process at all.
Diffstat (limited to 'lib/PublicInbox/Import.pm')
-rw-r--r--lib/PublicInbox/Import.pm3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/PublicInbox/Import.pm b/lib/PublicInbox/Import.pm
index c72c1e92..351bc660 100644
--- a/lib/PublicInbox/Import.pm
+++ b/lib/PublicInbox/Import.pm
@@ -441,7 +441,8 @@ sub run_die ($;$$) {
 }
 
 sub init_bare {
-        my ($dir) = @_;
+        my ($dir) = @_; # or self
+        $dir = $dir->{git}->{git_dir} if ref($dir);
         my @cmd = (qw(git init --bare -q), $dir);
         run_die(\@cmd);
         # set a reasonable default: