Added GetTags and GetBranches functions to GitRepository class

master
Sven Slootweg 12 years ago
parent abcc1e1f6c
commit 29932e886f

@ -96,6 +96,21 @@ class GitRepository
}
}
function GetBranches()
{
$branches = array();
foreach(scandir("{$this->path}/refs/heads/") as $branch)
{
if($branch != "." && $branch != "..")
{
$branches[$branch] = $this->GetBranch($branch);
}
}
return $branches;
}
function GetTag($name)
{
$filename = "{$this->path}/refs/tags/{$name}";
@ -111,6 +126,21 @@ class GitRepository
}
}
function GetTags()
{
$tags = array();
foreach(scandir("{$this->path}/refs/tags/") as $tag)
{
if($tag != "." && $tag != "..")
{
$tags[$tag] = $this->GetTag($tag);
}
}
return $tags;
}
function GetObjectForPath($origin, $path)
{
$path_parts = explode("/", $path);

@ -2,6 +2,8 @@
require("libgit/base.php");
$repo = new GitRepository("/home/occupy/testrepo.git");
$pack = new GitPack($repo, "pack-8503a2b8cf6e60831dd012afd4d486eb1eddfef8");
pretty_dump($pack->UnpackObject("a6269a2ffd269289d7d026818511fab88718feff"));
pretty_dump($repo->GetTags());
/*$pack = new GitPack($repo, "pack-8503a2b8cf6e60831dd012afd4d486eb1eddfef8");
pretty_dump($pack->UnpackObject("a6269a2ffd269289d7d026818511fab88718feff"));*/
//pretty_dump($repo->GetObjectForPath($repo->GetBranch("master")->GetTree(), "public_html/css/images/derp"));

Loading…
Cancel
Save