diff --git a/src/applications/diffusion/controller/DiffusionRepositoryCreateController.php b/src/applications/diffusion/controller/DiffusionRepositoryCreateController.php --- a/src/applications/diffusion/controller/DiffusionRepositoryCreateController.php +++ b/src/applications/diffusion/controller/DiffusionRepositoryCreateController.php @@ -134,7 +134,6 @@ $type_name = PhabricatorRepositoryTransaction::TYPE_NAME; $type_vcs = PhabricatorRepositoryTransaction::TYPE_VCS; $type_activate = PhabricatorRepositoryTransaction::TYPE_ACTIVATE; - $type_local_path = PhabricatorRepositoryTransaction::TYPE_LOCAL_PATH; $type_remote_uri = PhabricatorRepositoryTransaction::TYPE_REMOTE_URI; $type_hosting = PhabricatorRepositoryTransaction::TYPE_HOSTING; $type_http = PhabricatorRepositoryTransaction::TYPE_PROTOCOL_HTTP; @@ -179,16 +178,6 @@ ->setTransactionType($type_service) ->setNewValue($service->getPHID()); } - - $default_local_path = PhabricatorEnv::getEnvConfig( - 'repository.default-local-path'); - - $default_local_path = rtrim($default_local_path, '/'); - $default_local_path = $default_local_path.'/'.$callsign.'/'; - - $xactions[] = id(clone $template) - ->setTransactionType($type_local_path) - ->setNewValue($default_local_path); } if ($is_init) { diff --git a/src/applications/repository/editor/PhabricatorRepositoryEditor.php b/src/applications/repository/editor/PhabricatorRepositoryEditor.php --- a/src/applications/repository/editor/PhabricatorRepositoryEditor.php +++ b/src/applications/repository/editor/PhabricatorRepositoryEditor.php @@ -522,4 +522,27 @@ return true; } + protected function applyFinalEffects( + PhabricatorLiskDAO $object, + array $xactions) { + + // If the repository does not have a local path yet, assign it one based + // on its ID. We can't do this earlier because we won't have an ID yet. + $local_path = $object->getDetail('local-path'); + if (!strlen($local_path)) { + $local_key = 'repository.default-local-path'; + + $local_root = PhabricatorEnv::getEnvConfig($local_key); + $local_root = rtrim($local_root, '/'); + + $id = $object->getID(); + $local_path = "{$local_root}/{$id}/"; + + $object->setDetail('local-path', $local_path); + $object->save(); + } + + return $xactions; + } + }