summaryrefslogtreecommitdiff
path: root/git-debrebase
diff options
context:
space:
mode:
authorIan Jackson <ijackson@chiark.greenend.org.uk>2018-08-24 20:12:41 +0100
committerIan Jackson <ijackson@chiark.greenend.org.uk>2018-08-24 20:24:33 +0100
commitbd67a8122d87752668d1b5ee498359fcbcbe1ea5 (patch)
tree7b21ab78c37dee8e94b42af970a29094cf0795bb /git-debrebase
parent0a2ab1fafe5fe43e9ff07e9600bddfa4fd892c35 (diff)
git-debrebase: Fix get_tree's memoisation wrt $recurse
$recurse needs to be part of the key to the memo hash! Luckily, there is only one caller which calls with $recurse==1, check_series_has_all_patches. It ends up mishandles this situation by complaining about the directory names, as if they were unused patches. And after that no-one needs to call get_tree. Closes: #907202. Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Diffstat (limited to 'git-debrebase')
-rwxr-xr-xgit-debrebase6
1 files changed, 4 insertions, 2 deletions
diff --git a/git-debrebase b/git-debrebase
index 7629a14..4a70585 100755
--- a/git-debrebase
+++ b/git-debrebase
@@ -196,10 +196,12 @@ sub get_tree ($;$$) {
return () if $type eq 'missing';
}
+ $recurse = !!$recurse;
+
confess "get_tree needs object not $x ?" unless $x =~ m{^[0-9a-f]+\:};
our (@get_tree_memo, %get_tree_memo);
- my $memo = $get_tree_memo{$x};
+ my $memo = $get_tree_memo{$recurse,$x};
return @$memo if $memo;
local $Debian::Dgit::debugcmd_when_debuglevel = 3;
@@ -216,7 +218,7 @@ sub get_tree ($;$$) {
push @l, [ $n, $i ];
confess "$x need $last < $n ?" unless $last lt $n;
}
- $get_tree_memo{$x} = \@l;
+ $get_tree_memo{$recurse,$x} = \@l;
push @get_tree_memo, $x;
if (@get_tree_memo > 10) {
delete $get_tree_memo{ shift @get_tree_memo };