Serve Git reads over SSH
Summary: Like D7423, but for SSH. Test Plan: Ran `git clone ssh://...`, got a clone. Reviewers: btrahan Reviewed By: btrahan CC: hach-que, aran Maniphest Tasks: T2230 Differential Revision: https://secure.phabricator.com/D7424
This commit is contained in:
@@ -23,4 +23,12 @@ final class DiffusionSSHGitUploadPackWorkflow
|
||||
return head($args->getArg('dir'));
|
||||
}
|
||||
|
||||
protected function executeRepositoryOperations(
|
||||
PhabricatorRepository $repository) {
|
||||
|
||||
$future = new ExecFuture('git-upload-pack %s', $repository->getLocalPath());
|
||||
|
||||
return $this->passthruIO($future);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -10,6 +10,9 @@ abstract class DiffusionSSHWorkflow extends PhabricatorSSHWorkflow {
|
||||
|
||||
abstract protected function isReadOnly();
|
||||
abstract protected function getRequestPath();
|
||||
abstract protected function executeRepositoryOperations(
|
||||
PhabricatorRepository $repository);
|
||||
|
||||
protected function writeError($message) {
|
||||
$this->getErrorChannel()->write($message);
|
||||
return $this;
|
||||
@@ -20,15 +23,11 @@ abstract class DiffusionSSHWorkflow extends PhabricatorSSHWorkflow {
|
||||
|
||||
try {
|
||||
$repository = $this->loadRepository();
|
||||
|
||||
throw new Exception("TODO: Implement serve over SSH.");
|
||||
|
||||
return $this->executeRepositoryOperations($repository);
|
||||
} catch (Exception $ex) {
|
||||
$this->writeError(get_class($ex).': '.$ex->getMessage());
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
private function loadRepository() {
|
||||
|
||||
Reference in New Issue
Block a user