Changeset View
Changeset View
Standalone View
Standalone View
src/repository/api/ArcanistGitAPI.php
| Show All 15 Lines | final class ArcanistGitAPI extends ArcanistRepositoryAPI { | ||||
| private $symbolicHeadCommit; | private $symbolicHeadCommit; | ||||
| private $resolvedHeadCommit; | private $resolvedHeadCommit; | ||||
| public static function newHookAPI($root) { | public static function newHookAPI($root) { | ||||
| return new ArcanistGitAPI($root); | return new ArcanistGitAPI($root); | ||||
| } | } | ||||
| protected function buildLocalFuture(array $argv) { | protected function getBinaryName() { | ||||
| $argv[0] = 'git '.$argv[0]; | |||||
| $future = newv('ExecFuture', $argv); | |||||
| $future->setCWD($this->getPath()); | |||||
| return $future; | |||||
| } | |||||
| public function execPassthru($pattern /* , ... */) { | |||||
| $args = func_get_args(); | |||||
| static $git = null; | |||||
| if ($git === null) { | |||||
| if (phutil_is_windows()) { | if (phutil_is_windows()) { | ||||
| // NOTE: On Windows, phutil_passthru() uses 'bypass_shell' because | // NOTE: On Windows, passthru uses 'bypass_shell' because everything | ||||
| // everything goes to hell if we don't. We must provide an absolute | // goes to hell if we don't. We must provide an absolute path to Git for | ||||
| // path to Git for this to work properly. | // this to work properly. | ||||
| static $git; | |||||
| if ($git === null) { | |||||
| $git = Filesystem::resolveBinary('git'); | $git = Filesystem::resolveBinary('git'); | ||||
| $git = csprintf('%s', $git); | |||||
| } else { | |||||
| $git = 'git'; | |||||
| } | } | ||||
| return $git; | |||||
| } else { | |||||
| return 'git'; | |||||
| } | } | ||||
| $args[0] = $git.' '.$args[0]; | |||||
| return call_user_func_array('phutil_passthru', $args); | |||||
| } | } | ||||
| public function getSourceControlSystemName() { | public function getSourceControlSystemName() { | ||||
| return 'git'; | return 'git'; | ||||
| } | } | ||||
| public function getMetadataPath() { | public function getMetadataPath() { | ||||
| static $path = null; | static $path = null; | ||||
| if ($path === null) { | if ($path === null) { | ||||
| list($stdout) = $this->execxLocal('rev-parse --git-dir'); | list($stdout) = $this->execxLocal('rev-parse --git-dir'); | ||||
| ▲ Show 20 Lines • Show All 1,156 Lines • Show Last 20 Lines | |||||