8 * = either we have a temporary working directory created for each session/user etc..
10 * = what happens when multiple people try to access a working directory..
12 * = what happens if the same person is doing multiple things on the same workign directory..
18 require_once 'MTrack/SCM/WorkingCopy.php';
21 class MTrack_SCM_Git_WorkingCopy extends MTrack_SCM_WorkingCopy
24 public $push = false; ///
26 function __construct(MTrack_Repo $repo) {
28 $this->dir = $this->generateTempDir();;
32 MTrackSCM::run('git', 'string',
33 array('clone', $this->repo->repopath, $this->dir)
39 return stream_get_contents($this->git('push'));
44 function getFile($path)
46 return $this->repo->file($path);
49 function addFile($path)
51 $this->git('add', $path);
54 function delFile($path)
56 $this->git('rm', '-f', $path);
59 * @param {StdClass} $CS
61 * ->reason (optional)???
70 $d = strtotime($CS->when);
71 putenv("GIT_AUTHOR_DATE=$d -0000");
73 putenv("GIT_AUTHOR_DATE=");
76 $reason = trim($CS->reason);
77 if (!strlen($reason)) {
80 echo htmlspecialchars(implode(" ", array('commit', '-a', '-m', $reason ,
81 '--author="' . $CS->name . ' <'. $CS->email . '>"' )));exit;
83 return stream_get_contents(
84 $this->git('commit', '-a', '-m', $reason ,
85 '--author="' . $CS->name . ' <'. $CS->email . '>"' )
91 $args = func_get_args();
92 $a = array("--git-dir=$this->dir/.git", "--work-tree=$this->dir");
93 foreach ($args as $arg) {
97 return MTrackSCM::run('git', 'read', $a);