From 337f7be7057f98bee6509706d95d163c1a1212a7 Mon Sep 17 00:00:00 2001 From: Brian Cully Date: Mon, 30 Mar 2009 19:05:42 -0400 Subject: Fix a bug when reading the last object in a tree. --- read_object.pl | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/read_object.pl b/read_object.pl index 10a4e56..40013d4 100755 --- a/read_object.pl +++ b/read_object.pl @@ -107,6 +107,10 @@ sub format_tree { my @rc = (); while (@tree) { my ($info, $id) = (shift @tree, shift @tree); + unless ($id || @tree) { + $id = substr($info, -20); + $info = substr($info, 0, -21); + } $info =~ /^([^ ]*) (.*)/; my ($mode, $name) = ($1, $2); my @bytes = unpack('C*', $id); -- cgit v1.2.3