mirror of
https://we.phorge.it/source/phorge.git
synced 2025-03-29 04:28:12 +01:00
Summary: Ref T5655. Test Plan: `grep` Reviewers: epriestley, #blessed_reviewers Reviewed By: epriestley, #blessed_reviewers Subscribers: Korvin, epriestley Maniphest Tasks: T5655 Differential Revision: https://secure.phabricator.com/D11185
45 lines
1.2 KiB
PHP
45 lines
1.2 KiB
PHP
<?php
|
|
|
|
final class DiffusionGitReceivePackSSHWorkflow extends DiffusionGitSSHWorkflow {
|
|
|
|
public function didConstruct() {
|
|
$this->setName('git-receive-pack');
|
|
$this->setArguments(
|
|
array(
|
|
array(
|
|
'name' => 'dir',
|
|
'wildcard' => true,
|
|
),
|
|
));
|
|
}
|
|
|
|
protected function executeRepositoryOperations() {
|
|
$args = $this->getArgs();
|
|
$path = head($args->getArg('dir'));
|
|
$repository = $this->loadRepository($path);
|
|
|
|
// This is a write, and must have write access.
|
|
$this->requireWriteAccess();
|
|
|
|
$command = csprintf('git-receive-pack %s', $repository->getLocalPath());
|
|
$command = PhabricatorDaemon::sudoCommandAsDaemonUser($command);
|
|
|
|
$future = id(new ExecFuture('%C', $command))
|
|
->setEnv($this->getEnvironment());
|
|
|
|
$err = $this->newPassthruCommand()
|
|
->setIOChannel($this->getIOChannel())
|
|
->setCommandChannelFromExecFuture($future)
|
|
->execute();
|
|
|
|
if (!$err) {
|
|
$repository->writeStatusMessage(
|
|
PhabricatorRepositoryStatusMessage::TYPE_NEEDS_UPDATE,
|
|
PhabricatorRepositoryStatusMessage::CODE_OKAY);
|
|
$this->waitForGitClient();
|
|
}
|
|
|
|
return $err;
|
|
}
|
|
|
|
}
|