mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-19 12:00:55 +01: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:
parent
2fcf571bfd
commit
5592e59f92
1 changed files with 15 additions and 2 deletions
|
@ -62,8 +62,21 @@ abstract class PhabricatorRepositoryEngine extends Phobject {
|
|||
* @return void
|
||||
*/
|
||||
protected function verifyGitOrigin(PhabricatorRepository $repository) {
|
||||
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)) {
|
||||
|
|
Loading…
Reference in a new issue