]> Sergey Matveev's repositories - public-inbox.git/blobdiff - lib/PublicInbox/LEI.pm
lei: fix git-credential handling
[public-inbox.git] / lib / PublicInbox / LEI.pm
index bad7fad94f1b195d896741be8cd4e74362bcb92a..f9361c68240fac3f331ea01fa130b6603eefb249 100644 (file)
@@ -121,7 +121,7 @@ sub index_opt {
 
 my @c_opt = qw(c=s@ C=s@ quiet|q);
 my @lxs_opt = (qw(remote! local! external! include|I=s@ exclude=s@ only=s@
-       import-remote!  no-torsocks torsocks=s),
+       import-remote! no-torsocks torsocks=s),
        PublicInbox::LeiQuery::curl_opt());
 
 # we generate shell completion + help using %CMD and %OPTDESC,
@@ -160,8 +160,8 @@ our %CMD = ( # sorted in order of importance/use:
 'plonk' => [ '--threads|--from=IDENT',
        'exclude mail matching From: or threads from non-Message-ID searches',
        qw(stdin| threads|t from|f=s mid=s oid=s), @c_opt ],
-'mark' => [ 'KEYWORDS...',
-       'set/unset keywords on message(s)',
+'tag' => [ 'KEYWORDS...',
+       'set/unset keywords and/or labels on message(s)',
        qw(stdin| in-format|F=s input|i=s@ oid=s@ mid=s@), @c_opt,
        pass_through('-kw:foo for delete') ],
 'forget' => [ '[--stdin|--oid=OID|--by-mid=MID]',
@@ -172,15 +172,6 @@ our %CMD = ( # sorted in order of importance/use:
        'remove imported messages from IMAP, Maildirs, and MH',
        qw(exact! all jobs:i indexed), @c_opt ],
 
-# code repos are used for `show' to solve blobs from patch mails
-'add-coderepo' => [ 'DIRNAME', 'add or set priority of a git code repo',
-       qw(boost=i), @c_opt ],
-'ls-coderepo' => [ '[FILTER_TERMS...]',
-               'list known code repos', qw(format|f=s z), @c_opt ],
-'forget-coderepo' => [ 'DIRNAME',
-       'stop using repo to solve blobs from patches',
-       qw(prune), @c_opt ],
-
 'add-watch' => [ 'LOCATION', 'watch for new messages and flag changes',
        qw(import! kw|keywords|flags! interval=s recursive|r
        exclude=s include=s), @c_opt ],
@@ -249,7 +240,12 @@ my %OPTDESC = (
                "and\xa0'[]'\x{a0}ranges",
 'verbose|v+' => 'be more verbose',
 'external!' => 'do not use externals',
-'solve!' => 'do not attempt to reconstruct blobs from emails',
+'mail!' => 'do not look in mail storage for OID',
+'cwd!' => 'do not look in git repo of current working directory',
+'oid-a|A=s' => 'pre-image OID',
+'path-a|a=s' => 'pre-image pathname associated with OID',
+'path-b|b=s' => 'post-image pathname associated with OID',
+'git-dir=s@' => 'additional git repository to scan',
 'torsocks=s' => ['VAL|auto|no|yes',
                'whether or not to wrap git and curl commands with torsocks'],
 'no-torsocks' => 'alias for --torsocks=no',
@@ -352,7 +348,7 @@ my %CONFIG_KEYS = (
        'leistore.dir' => 'top-level storage location',
 );
 
-my @WQ_KEYS = qw(lxs l2m imp mrr cnv p2q mark sol); # internal workers
+my @WQ_KEYS = qw(lxs l2m imp mrr cnv p2q tag sol); # internal workers
 
 # pronounced "exit": x_it(1 << 8) => exit(1); x_it(13) => SIGPIPE
 sub x_it ($$) {
@@ -786,7 +782,7 @@ sub lei__complete {
                        if (s/[:=].+\z//) { # req/optional args, e.g output|o=i
                        } elsif (s/\+\z//) { # verbose|v+
                        } elsif (s/!\z//) {
-                               # negation: solve! => no-solve|solve
+                               # negation: mail! => no-mail|mail
                                s/([\w\-]+)/$1|no-$1/g
                        }
                        map {
@@ -843,7 +839,13 @@ sub start_mua {
        if (my $sock = $self->{sock}) { # lei(1) client process runs it
                send($sock, exec_buf(\@cmd, {}), MSG_EOR);
        } elsif ($self->{oneshot}) {
-               $self->{"pid.$self.$$"}->{spawn(\@cmd)} = \@cmd;
+               my $pid = fork // die "fork: $!";
+               if ($pid > 0) { # original process
+                       exec(@cmd);
+                       warn "exec @cmd: $!\n";
+                       POSIX::_exit(1);
+               }
+               POSIX::setsid() > 0 or die "setsid: $!";
        }
        if ($self->{lxs} && $self->{au_done}) { # kick wait_startq
                syswrite($self->{au_done}, 'q' x ($self->{lxs}->{jobs} // 0));