diff options
author | Ian Jackson <ijackson@chiark.greenend.org.uk> | 2018-08-19 17:47:39 +0100 |
---|---|---|
committer | Ian Jackson <ijackson@chiark.greenend.org.uk> | 2018-08-19 17:47:39 +0100 |
commit | e2a5e5241eb7e838c6d483800bde4bdb67af3949 (patch) | |
tree | c7c50e18951ca5287365175b3a4894b184a9d1a7 | |
parent | d806e898308acbaca5685a4dec6688c0164ea642 (diff) |
git-debrebase: get_tree: Support '' for nonexistent objects
This is going to be convenient in a moment.
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
-rwxr-xr-x | git-debrebase | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/git-debrebase b/git-debrebase index 8fa5adb..57bfa98 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 (<mode> <type> <hash>) - # 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; |