1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-09-20 01:08:50 +02:00

Improve error message if local Git working copy directory exists but isn't a working copy

Summary: Fixes T9701. I don't want to try to autofix this because destroying the directory could destroy important files, but we can improve the error message.

Test Plan: Faked a failure, ran `repository update X`, got a more tailored error message.

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T9701

Differential Revision: https://secure.phabricator.com/D14971
This commit is contained in:
epriestley 2016-01-08 06:38:25 -08:00
parent 2fcf571bfd
commit 5592e59f92

View file

@ -62,8 +62,21 @@ abstract class PhabricatorRepositoryEngine extends Phobject {
* @return void
*/
protected function verifyGitOrigin(PhabricatorRepository $repository) {
list($remotes) = $repository->execxLocalCommand(
'remote show -n origin');
try {
list($remotes) = $repository->execxLocalCommand(
'remote show -n origin');
} catch (CommandException $ex) {
throw new PhutilProxyException(
pht(
'Expected to find a Git working copy at path "%s", but the '.
'path exists and is not a valid working copy. If you remove '.
'this directory, the daemons will automatically recreate it '.
'correctly. Phabricator will not destroy the directory for you '.
'because it can not be sure that it does not contain important '.
'data.',
$repository->getLocalPath()),
$ex);
}
$matches = null;
if (!preg_match('/^\s*Fetch URL:\s*(.*?)\s*$/m', $remotes, $matches)) {