Differential D15790 Diff 38050 src/applications/diffusion/ssh/DiffusionGitReceivePackSSHWorkflow.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/diffusion/ssh/DiffusionGitReceivePackSSHWorkflow.php
Show All 9 Lines | $this->setArguments( | ||||
'name' => 'dir', | 'name' => 'dir', | ||||
'wildcard' => true, | 'wildcard' => true, | ||||
), | ), | ||||
)); | )); | ||||
} | } | ||||
protected function executeRepositoryOperations() { | protected function executeRepositoryOperations() { | ||||
$repository = $this->getRepository(); | $repository = $this->getRepository(); | ||||
$viewer = $this->getViewer(); | |||||
// This is a write, and must have write access. | // This is a write, and must have write access. | ||||
$this->requireWriteAccess(); | $this->requireWriteAccess(); | ||||
$cluster_engine = id(new DiffusionRepositoryClusterEngine()) | |||||
->setViewer($viewer) | |||||
->setRepository($repository); | |||||
if ($this->shouldProxy()) { | if ($this->shouldProxy()) { | ||||
$command = $this->getProxyCommand(); | $command = $this->getProxyCommand(); | ||||
$did_synchronize = false; | $did_synchronize = false; | ||||
} else { | } else { | ||||
$command = csprintf('git-receive-pack %s', $repository->getLocalPath()); | $command = csprintf('git-receive-pack %s', $repository->getLocalPath()); | ||||
$did_synchronize = true; | $did_synchronize = true; | ||||
$viewer = $this->getUser(); | $cluster_engine->synchronizeWorkingCopyBeforeWrite(); | ||||
$repository->synchronizeWorkingCopyBeforeWrite($viewer); | |||||
} | } | ||||
$caught = null; | $caught = null; | ||||
try { | try { | ||||
$err = $this->executeRepositoryCommand($command); | $err = $this->executeRepositoryCommand($command); | ||||
} catch (Exception $ex) { | } catch (Exception $ex) { | ||||
$caught = $ex; | $caught = $ex; | ||||
} | } | ||||
// We've committed the write (or rejected it), so we can release the lock | // We've committed the write (or rejected it), so we can release the lock | ||||
// without waiting for the client to receive the acknowledgement. | // without waiting for the client to receive the acknowledgement. | ||||
if ($did_synchronize) { | if ($did_synchronize) { | ||||
$repository->synchronizeWorkingCopyAfterWrite(); | $cluster_engine->synchronizeWorkingCopyAfterWrite(); | ||||
} | } | ||||
if ($caught) { | if ($caught) { | ||||
throw $caught; | throw $caught; | ||||
} | } | ||||
if (!$err) { | if (!$err) { | ||||
$repository->writeStatusMessage( | $repository->writeStatusMessage( | ||||
Show All 22 Lines |