diff options
author | Brian Cully <bjc@kublai.com> | 2009-03-30 19:05:42 -0400 |
---|---|---|
committer | Brian Cully <bjc@kublai.com> | 2009-03-30 19:05:42 -0400 |
commit | 337f7be7057f98bee6509706d95d163c1a1212a7 (patch) | |
tree | 94c2e4743772f6ccdc867a8d58a07ac820108b55 | |
parent | 413010caec9a5a1c5eee37a80f69b1fd5d195d31 (diff) | |
download | dvcs-git-slides-337f7be7057f98bee6509706d95d163c1a1212a7.tar.gz dvcs-git-slides-337f7be7057f98bee6509706d95d163c1a1212a7.zip |
Fix a bug when reading the last object in a tree.
-rwxr-xr-x | read_object.pl | 4 |
1 files changed, 4 insertions, 0 deletions
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); |