diff --git a/public_html/libgit/class.tree.php b/public_html/libgit/class.tree.php index 3f42d4c..1ce4dee 100644 --- a/public_html/libgit/class.tree.php +++ b/public_html/libgit/class.tree.php @@ -41,10 +41,13 @@ class GitTree extends GitObject foreach($lines as $line) { - list($metadata, $binhash) = explode("\0", $line, 2); - list($mode, $filename) = explode(" ", $metadata, 2); - $hash = sha1_from_bin($binhash); - $this->elements[] = new GitTreeElement($mode, $filename, $hash); + if(!empty($line)) + { + list($metadata, $binhash) = explode("\0", $line, 2); + list($mode, $filename) = explode(" ", $metadata, 2); + $hash = sha1_from_bin($binhash); + $this->elements[] = new GitTreeElement($mode, $filename, $hash); + } } } } diff --git a/public_html/test.php b/public_html/test.php index 56bf6d7..c405642 100644 --- a/public_html/test.php +++ b/public_html/test.php @@ -2,7 +2,7 @@ require("libgit/base.php"); $repo = new GitRepository("/home/occupy/testrepo.git"); -pretty_dump($repo->GetTag("1.0")->GetCommit()); +pretty_dump($repo->GetTag("1.0")->GetTree()); /*pretty_dump($s->GetObject("54e03e490b1bee1c154c3545bf258cab0629ee02")); pretty_dump($s->GetObject("98d99489382a3541e6783bb2083554785f3eb72a"));