From 2d2110b455da97362135d27bc694693e7cd763e9 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Mon, 23 Jan 2012 01:34:53 +0000 Subject: [PATCH] fix $want handling --- BUGS | 2 -- Topbloke.pm | 8 +++++--- tb-list.pl | 3 +++ 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/BUGS b/BUGS index 77e3da4..e69de29 100644 --- 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) diff --git a/Topbloke.pm b/Topbloke.pm index 66139e1..5dcfb71 100644 --- a/Topbloke.pm +++ b/Topbloke.pm @@ -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)', diff --git a/tb-list.pl b/tb-list.pl index 620f759..e88b17d 100755 --- a/tb-list.pl +++ b/tb-list.pl @@ -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; } -- 2.30.2