diff --git a/public_html/libgit/class.pack.php b/public_html/libgit/class.pack.php
index 890732b..d4612a6 100644
--- a/public_html/libgit/class.pack.php
+++ b/public_html/libgit/class.pack.php
@@ -46,10 +46,12 @@ class GitPack
case OBJ_TAG:
// this is a compressed object
$data = fread($file, $size);
+ return $this->repo->CreateObject(gzuncompress($data), $type, $size);
break;
case OBJ_OFS_DELTA:
case OBJ_REF_DELTA:
// this is a delta
+ throw new Exception("This is not yet implemented.");
break;
default:
throw new GitUnknownTypeException("The object type is not supported.");
diff --git a/public_html/libgit/class.repository.php b/public_html/libgit/class.repository.php
index 2ba563e..6415a3e 100644
--- a/public_html/libgit/class.repository.php
+++ b/public_html/libgit/class.repository.php
@@ -20,7 +20,36 @@ class GitRepository
function GetObject($sha)
{
- list($header, $data) = explode("\0", $this->GetObjectRaw($sha), 2);
+ return $this->CreateObject($this->GetObjectRaw($sha));
+ }
+
+ function CreateObject($data, $type = null, $size = null)
+ {
+ if($type == null && $size == null)
+ {
+ list($header, $data) = explode("\0", $data, 2);
+ }
+ else
+ {
+ switch($type)
+ {
+ case OBJ_BLOB:
+ $typestring = "blob";
+ break;
+ case OBJ_TREE:
+ $typestring = "tree";
+ break;
+ case OBJ_TAG:
+ $typestring = "tag";
+ break;
+ case OBJ_COMMIT:
+ $typestring = "commit";
+ break;
+ default:
+ throw new GitUnknownTypeException("The specified type is not valid for this function.");
+ }
+ $header = "{$typestring} {$size}";
+ }
if(strpos($header, " ") !== false)
{
diff --git a/public_html/test.php b/public_html/test.php
index cd324cf..ec29a2b 100644
--- a/public_html/test.php
+++ b/public_html/test.php
@@ -2,5 +2,6 @@
require("libgit/base.php");
$repo = new GitRepository("/home/occupy/testrepo.git");
-pretty_dump(new GitPack($repo, "pack-8503a2b8cf6e60831dd012afd4d486eb1eddfef8"));
+$pack = new GitPack($repo, "pack-8503a2b8cf6e60831dd012afd4d486eb1eddfef8");
+pretty_dump($pack->UnpackObject("a6269a2ffd269289d7d026818511fab88718feff"));
//pretty_dump($repo->GetObjectForPath($repo->GetBranch("master")->GetTree(), "public_html/css/images/derp"));