diff --git a/public_html/libgit/class.repository.php b/public_html/libgit/class.repository.php index 6415a3e..01bf1ef 100644 --- a/public_html/libgit/class.repository.php +++ b/public_html/libgit/class.repository.php @@ -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); diff --git a/public_html/test.php b/public_html/test.php index ec29a2b..c6820ad 100644 --- a/public_html/test.php +++ b/public_html/test.php @@ -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"));