[PATCH 3/4] nmbug: Catch stderr in is_unmerged

David Bremner bremner at debian.org
Wed Jul 16 03:04:19 PDT 2014


"W. Trevor King" <wking at tremily.us> writes:

>
> There should be standard Perl syntax for capturing both streams ;).  I
> can add a separate parameter instead, but Perl doesn't seem to have
> keyword-arguments.  At least, nmbug relies on assumptions about
> argument values:
>
>   sub git_pipe {
>     my $envref = (ref $_[0] eq 'HASH') ? shift : {};
>     my $ioref  = (ref $_[0] eq 'ARRAY') ? shift : undef;
>     my $dir = ($_[0] eq '-|' or $_[0] eq '|-') ? shift : undef;
>>   }
>

Perl supports keyword arguments fine, by passing a single hash 
to the subroutine. This particular sub doesn't do things that way, but
it's only called in three places, so it would be simple enough to change
the calling convention to to

git_pipe (env => {}, lines=>[], 
         command => [  qw/diff-index --cached/,
		 "--diff-filter=$filter", qw/--name-only HEAD/ ],
         redirect => [ whatever you want here ]                 
         )


>  I'd be happy to rewrite nmbug in Python too, which has (to my eyes)
> much saner kwargs and subprocess handling.

Although I think that's an extreme answer to this particular issue ;), I
do think it's worth discussing. In particular I think it would be
reasonable to consider an updated nmbug that used the python bindings to
notmuch, for possibly more speed. Of the people that currently work on
nmbug (I count myself, yourself, and Tomi), I think we're all ok with
python.  I know at least Jani mentioned he'd be more interested in
contributing to a python version.

d



More information about the notmuch mailing list