From: Ian Jackson Date: Sun, 19 Aug 2018 16:47:39 +0000 (+0100) Subject: git-debrebase: get_tree: Support '' for nonexistent objects X-Git-Tag: archive/debian/6.7~48 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=dgit.git;a=commitdiff_plain;h=e2a5e5241eb7e838c6d483800bde4bdb67af3949;hp=d806e898308acbaca5685a4dec6688c0164ea642 git-debrebase: get_tree: Support '' for nonexistent objects This is going to be convenient in a moment. Signed-off-by: Ian Jackson --- diff --git a/git-debrebase b/git-debrebase index 8fa5adb7..57bfa982 100755 --- a/git-debrebase +++ b/git-debrebase @@ -187,8 +187,12 @@ sub get_tree ($) { # tree object name => ([ $name, $info ], ...) # where $name is the sort key, ie has / at end for subtrees # $info is the LHS from git-ls-tree ( ) - # will crash if $x does not exist, so don't do that + # will crash if $x does not exist, so don't do that; + # instead pass '' to get (). my ($x) = @_; + + return () if !length $x; + our (@get_tree_memo, %get_tree_memo); my $memo = $get_tree_memo{$x}; return @$memo if $memo;