]> khamidou — GitHub mirrors - arcanist.git/commitdiff
fix tab complete for out-of-workdir
authorAviv Eyal <avivey@gmail.com>
Wed, 26 Mar 2014 00:32:58 +0000 (17:32 -0700)
committerepriestley <git@epriestley.com>
Wed, 26 Mar 2014 00:33:23 +0000 (17:33 -0700)
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

scripts/arcanist.php
src/workflow/ArcanistShellCompleteWorkflow.php

index a64929a64c0af2ba39bd6ae07336d0065b29f5d4..2b0159d7fda46f190f98693412d98e74e2b58082 100755 (executable)
@@ -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);
index 69527f1fbe98248b20a683109bf9401c5498f63d..82cea04f8e9b3ed64302531b345419b0037d52d9 100644 (file)
@@ -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);