mirror of
https://we.phorge.it/source/arcanist.git
synced 2024-11-09 16:32:39 +01:00
fix tab complete for out-of-workdir
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
This commit is contained in:
parent
46fe94db9f
commit
d0bab7f34a
2 changed files with 5 additions and 4 deletions
|
@ -193,7 +193,7 @@ try {
|
|||
$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.");
|
||||
|
@ -286,7 +286,8 @@ try {
|
|||
$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);
|
||||
|
|
|
@ -58,9 +58,9 @@ EOTEXT
|
|||
// 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);
|
||||
|
|
Loading…
Reference in a new issue