/** * Verify if the repository root points to a valid Git repository. * * @return boolean * TRUE if the repository path is a bare Git Repository. */ public function isValidGitRepo() { // do not use exec() method to get the shell return code if (!$this->envSet) { $this->setEnv(); } $logs = array(); $git_bin = _versioncontrol_git_get_binary_path(); exec(escapeshellcmd("{$git_bin} ls-files"), $logs, $shell_return); if ($shell_return != 0) { return FALSE; } return TRUE; }
public function passthru($command, $exception = FALSE) { $command = escapeshellcmd(_versioncontrol_git_get_binary_path() . ' ' . $command); $env = array('GIT_DIR' => $this->repository->root); return $this->proc_open($command, $exception, file_exists($this->repository->root) ? $this->repository->root : NULL, $env); }