9f600888bc1a786f227980b339cdba7461a91179
4 * Represents a Git repository, and allows access to history, snapshots,
9 const DAEMON_EXPORT_FILE
= 'git-daemon-export-ok';
12 * Path to this repository.
17 * Whether or not this is a bare repository.
22 * Interface to Git itself.
27 * @param $path Path to the repository (either working copy or bare)
29 public function __construct($path) {
30 $path = realpath($path);
31 if (file_exists($p = $path . Git
::S
. '.git')) {
34 } elseif (file_exists($path) && strlen($path) >= 4 && substr($path, -4) == '.git') {
37 } elseif (!file_exists($path)) {
38 throw new Git_Exception_InvalidRepository();
40 $this->git
= new Git($this->path
);
43 // * means will implement soon
45 // public function description() {
46 // * public function heads() {
47 // * public function branches() {return $this->heads();}
48 // public function tags() {
49 // * public function commits($start, $max_count, $skip) {
50 // public function commitsBetween($frm, $to) {
51 // public function commitsSince($start = 'master', $since) {
52 // public function commitCount($start = 'master') {
53 // * public function commit($id) {
54 // public function commitDeltasFrom($other_repo, $ref = 'master', $other_ref = 'master') {
55 // * public function tree($treeish = 'master', $paths = array()) {
56 // * public function blob($id) {
59 * Returns the commit log for a treeish entity.
60 * @param $commit Commit to get log of, or commit range like begin..end
61 * @param $path Path (or paths) to get logs for
62 * @param $kwargs Extra arguments, see Git->transformArgs()
64 public function log($commit = 'master', $path = null, $kwargs = array()) {
65 $options = array_merge(array('pretty' => 'raw'), $kwargs);
67 $arg = array($commit, '--', $path);
69 $arg = array($commit);
71 $commits = $this->git
->log($path, $options);
72 return Commit
::listFromString($commits);
75 // public function diff($a, $b, $paths = array()) {
76 // public function commitDiff($commit) {
77 // public static function initBare($path, $kwargs) {
78 // public static function forkBare($path, $kwargs) {
79 // public function archiveTar($treeish = 'master', $prefix = null) {
80 // public function archiveTarGz($treeish = 'master', $prefix = null) {
81 // public function enableDaemonServe() {
82 // public function disableDaemonServe() {
83 // ? private function _getAlternates() {
84 // ? private function _setAlternates() {
86 public function __toString() {
87 return '(Git_Repo "'. $this->path
.'")';