chiark / gitweb /
fix $want handling
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Mon, 23 Jan 2012 01:34:53 +0000 (01:34 +0000)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Mon, 23 Jan 2012 01:34:53 +0000 (01:34 +0000)
BUGS
Topbloke.pm
tb-list.pl

diff --git a/BUGS b/BUGS
index 77e3da4e390032a7b8f8a2b9a96962bbd295eca4..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 100644 (file)
--- a/BUGS
+++ b/BUGS
@@ -1,2 +0,0 @@
-list -l does not work (lists 2012-01-23T011243Z/sponge)
-list -r sponge2 does not work (fails to list 2012-01-23T011243Z/sponge)
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)',
index 620f7599650aec3b2baff315263728ab8ea12f87..e88b17d93d9c0c691ae472770251f498176bf85c 100755 (executable)
@@ -63,10 +63,13 @@ foreach_patch($relatedto || $leaves || !$spec ? { } : $spec,
 #----- selection -----
 
 if ($leaves) {
+    debug("leaves");
     foreach my $p (keys %patches) {
+       debug("leaves $p");
        my $v = $patches{$p};
        next if $v->{Info}[0]{Deleted};
        foreach my $dep (keys %{ $v->{Info}[1] }) {
+           debug("leaves $p $dep");
            next unless exists $patches{$dep};
            $patches{$dep}{NotLeaf} = 1;
        }