Differential D15688 Diff 37804 src/applications/diffusion/ssh/DiffusionGitReceivePackSSHWorkflow.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/diffusion/ssh/DiffusionGitReceivePackSSHWorkflow.php
Show All 15 Lines | final class DiffusionGitReceivePackSSHWorkflow extends DiffusionGitSSHWorkflow { | ||||
protected function executeRepositoryOperations() { | protected function executeRepositoryOperations() { | ||||
$repository = $this->getRepository(); | $repository = $this->getRepository(); | ||||
// This is a write, and must have write access. | // This is a write, and must have write access. | ||||
$this->requireWriteAccess(); | $this->requireWriteAccess(); | ||||
if ($this->shouldProxy()) { | if ($this->shouldProxy()) { | ||||
$command = $this->getProxyCommand(); | $command = $this->getProxyCommand(); | ||||
$is_proxy = true; | |||||
} else { | } else { | ||||
$command = csprintf('git-receive-pack %s', $repository->getLocalPath()); | $command = csprintf('git-receive-pack %s', $repository->getLocalPath()); | ||||
$is_proxy = false; | |||||
$repository->synchronizeWorkingCopyBeforeWrite(); | |||||
} | } | ||||
$command = PhabricatorDaemon::sudoCommandAsDaemonUser($command); | $command = PhabricatorDaemon::sudoCommandAsDaemonUser($command); | ||||
$future = id(new ExecFuture('%C', $command)) | $future = id(new ExecFuture('%C', $command)) | ||||
->setEnv($this->getEnvironment()); | ->setEnv($this->getEnvironment()); | ||||
$err = $this->newPassthruCommand() | $err = $this->newPassthruCommand() | ||||
->setIOChannel($this->getIOChannel()) | ->setIOChannel($this->getIOChannel()) | ||||
->setCommandChannelFromExecFuture($future) | ->setCommandChannelFromExecFuture($future) | ||||
->execute(); | ->execute(); | ||||
if (!$err) { | if (!$err) { | ||||
$repository->writeStatusMessage( | $repository->writeStatusMessage( | ||||
PhabricatorRepositoryStatusMessage::TYPE_NEEDS_UPDATE, | PhabricatorRepositoryStatusMessage::TYPE_NEEDS_UPDATE, | ||||
PhabricatorRepositoryStatusMessage::CODE_OKAY); | PhabricatorRepositoryStatusMessage::CODE_OKAY); | ||||
$this->waitForGitClient(); | $this->waitForGitClient(); | ||||
} | } | ||||
if (!$is_proxy) { | |||||
$repository->synchronizeWorkingCopyAfterWrite(); | |||||
} | |||||
return $err; | return $err; | ||||
} | } | ||||
} | } |