chiark / gitweb /
fix $want handling
[topbloke.git] / Topbloke.pm
index 66139e15b4907913296a88227051309366499216..5dcfb7124692ad0a6b58bb91ea8adace499a1e22 100644 (file)
@@ -367,13 +367,15 @@ sub foreach_patch ($$$$) {
     #  and if $want->[$item] is not true, the corresponding item may be undef
     # and $parsedname is only valid if $spec is not undef
     #  (say $spec { }  if you want the name parsed but no restrictions)
+    my @want = @$want;
+    $want[0] ||= !$deleted_ok;
     run_git(sub {
        debug("foreach_patch considering $_");
        m/ / or die "$_ ?";
        my $objname = $`;
        my @out;
        my $patch = substr($',19); #');
-       $want->[0] ||= !$deleted_ok;
+       my $wantix = 0;
        foreach my $file (qw(flags deps pflags included)) {
 
            if ($file eq 'deps') {
@@ -390,7 +392,7 @@ sub foreach_patch ($$$$) {
                }
            }
 
-           if (!shift @$want) {
+           if (!$want[$wantix++]) {
                push @out, undef;
                next;
            }
@@ -407,7 +409,7 @@ sub foreach_patch ($$$$) {
 
            push @out, \%data;
        }
-       debug("foreach_patch  YES @out"), return
+       debug("foreach_patch  YES ".(join '', map { 0+defined } @out)), return
        $body->($patch, @out);
            },
            qw(for-each-ref --format), '%(objectname) %(refname)',