Summary:
see https://github.com/facebook/phabricator/issues/546 - arc complete blows up when not
in a workdir.
There's no "is ArcanistWorkingCopyIdentity object valid" method, but getVCSType() looks like the
closest match.
git grep for `getProjectRoot` didn't reveal any more problmatic call sites.
Test Plan: `arc [tab] [tab]`
Reviewers: #blessed_reviewers, epriestley
Reviewed By: #blessed_reviewers, epriestley
Subscribers: epriestley, Korvin
Differential Revision: https://secure.phabricator.com/D8578
$need_repository_api;
if ($need_working_copy || $want_working_copy) {
- if ($need_working_copy && !$working_copy->getProjectRoot()) {
+ if ($need_working_copy && !$working_copy->getVCSType()) {
throw new ArcanistUsageException(
"This command must be run in a Git, Mercurial or Subversion working ".
"copy.");
$workflow->authenticateConduit();
}
- if ($need_repository_api || ($want_repository_api && $working_copy)) {
+ if ($need_repository_api ||
+ ($want_repository_api && $working_copy->getVCSType())) {
$repository_api = ArcanistRepositoryAPI::newAPIFromConfigurationManager(
$configuration_manager);
$workflow->setRepositoryAPI($repository_api);
// We have to build our own because if we requiresWorkingCopy() we'll throw
// if we aren't in a .arcconfig directory. We probably still can't do much,
// but commands can raise more detailed errors.
- $working_copy = ArcanistWorkingCopyIdentity::newFromPath(getcwd());
$configuration_manager = $this->getConfigurationManager();
- if ($working_copy->getProjectRoot()) {
+ $working_copy = ArcanistWorkingCopyIdentity::newFromPath(getcwd());
+ if ($working_copy->getVCSType()) {
$configuration_manager->setWorkingCopyIdentity($working_copy);
$repository_api = ArcanistRepositoryAPI::newAPIFromConfigurationManager(
$configuration_manager);