about summary refs log tree commit homepage
diff options
context:
space:
mode:
-rw-r--r--lib/PublicInbox/Import.pm9
-rw-r--r--t/git.t4
2 files changed, 9 insertions, 4 deletions
diff --git a/lib/PublicInbox/Import.pm b/lib/PublicInbox/Import.pm
index 2cb4896a..e0a84bfd 100644
--- a/lib/PublicInbox/Import.pm
+++ b/lib/PublicInbox/Import.pm
@@ -48,7 +48,7 @@ sub gfi_start {
 
         return ($self->{in}, $self->{out}) if $self->{pid};
 
-        my (@ret, $out_r, $out_w);
+        my ($in_r, $pid, $out_r, $out_w);
         pipe($out_r, $out_w) or die "pipe failed: $!";
 
         $self->lock_acquire;
@@ -56,27 +56,28 @@ sub gfi_start {
                 my ($git, $ref) = @$self{qw(git ref)};
                 local $/ = "\n";
                 chomp($self->{tip} = $git->qx(qw(rev-parse --revs-only), $ref));
+                die "fatal: rev-parse --revs-only $ref: \$?=$?" if $?;
                 if ($self->{path_type} ne '2/38' && $self->{tip}) {
                         local $/ = "\0";
                         my @t = $git->qx(qw(ls-tree -r -z --name-only), $ref);
+                        die "fatal: ls-tree -r -z --name-only $ref: \$?=$?" if $?;
                         chomp @t;
                         $self->{-tree} = { map { $_ => 1 } @t };
                 }
                 my @cmd = ('git', "--git-dir=$git->{git_dir}",
                         qw(fast-import --quiet --done --date-format=raw));
-                my ($in_r, $pid) = popen_rd(\@cmd, undef, { 0 => $out_r });
+                ($in_r, $pid) = popen_rd(\@cmd, undef, { 0 => $out_r });
                 $out_w->autoflush(1);
                 $self->{in} = $in_r;
                 $self->{out} = $out_w;
                 $self->{pid} = $pid;
                 $self->{nchg} = 0;
-                @ret = ($in_r, $out_w);
         };
         if ($@) {
                 $self->lock_release;
                 die $@;
         }
-        @ret;
+        ($in_r, $out_w);
 }
 
 sub wfail () { die "write to fast-import failed: $!" }
diff --git a/t/git.t b/t/git.t
index dcd053c5..2cfff248 100644
--- a/t/git.t
+++ b/t/git.t
@@ -76,13 +76,17 @@ if (1) {
         is(length($$x), $size, 'read correct number of bytes');
 
         my $ref = $gcf->qx(qw(cat-file blob), $buf);
+        is($?, 0, 'no error on scalar success');
         my @ref = $gcf->qx(qw(cat-file blob), $buf);
+        is($?, 0, 'no error on wantarray success');
         my $nl = scalar @ref;
         ok($nl > 1, "qx returned array length of $nl");
         is(join('', @ref), $ref, 'qx array and scalar context both work');
 
         $gcf->qx(qw(repack -adq));
         ok($gcf->packed_bytes > 0, 'packed size is positive');
+        $gcf->qx(qw(rev-parse --verify bogus));
+        isnt($?, 0, '$? set on failure'.$?);
 }
 
 SKIP: {