]> khamidou — GitHub mirrors - arcanist.git/commitdiff
Remove reentrant code
authorJoshua Spence <josh@joshuaspence.com>
Mon, 25 May 2015 12:41:22 +0000 (22:41 +1000)
committerJoshua Spence <josh@joshuaspence.com>
Mon, 25 May 2015 12:41:22 +0000 (22:41 +1000)
Summary: Ref T7604. Remove the `reenter_if_this_is_arcanist_or_libphutil` function. Some discussion in D12945.

Test Plan: Ran `./bin/arc --trace help` and saw things happen as expected.

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: Korvin, epriestley

Maniphest Tasks: T7604

Differential Revision: https://secure.phabricator.com/D12999

scripts/arcanist.php

index 8df56284d93a4961d69c10380e24264252a15121..ca557f57f589dd6f9011321903989ae4e9e602b8 100755 (executable)
@@ -114,11 +114,6 @@ try {
   }
   $configuration_manager->setWorkingCopyIdentity($working_copy);
 
-  reenter_if_this_is_arcanist_or_libphutil(
-    $console,
-    $working_copy,
-    $original_argv);
-
   // Load additional libraries, which can provide new classes like configuration
   // overrides, linters and lint engines, unit test engines, etc.
 
@@ -646,75 +641,3 @@ function arcanist_load_libraries(
     }
   }
 }
-
-
-/**
- * NOTE: SPOOKY BLACK MAGIC
- *
- * When arc is run in a copy of arcanist other than itself, or a copy of
- * libphutil other than the one we loaded, reenter the script and force it
- * to use the current working directory instead of the default.
- *
- * In the case of execution inside arcanist/, we force execution of the local
- * arc binary.
- *
- * In the case of execution inside libphutil/, we force the local copy to load
- * instead of the one selected by default rules.
- *
- * @param PhutilConsole                 Console.
- * @param ArcanistWorkingCopyIdentity   The current working copy.
- * @param array                         Original arc arguments.
- * @return void
- */
-function reenter_if_this_is_arcanist_or_libphutil(
-  PhutilConsole $console,
-  ArcanistWorkingCopyIdentity $working_copy,
-  array $original_argv) {
-
-  $project_id = $working_copy->getProjectID();
-  if ($project_id != 'arcanist' && $project_id != 'libphutil') {
-    // We're not in a copy of arcanist or libphutil.
-    return;
-  }
-
-  $library_names = array(
-    'arcanist'  => 'arcanist',
-    'libphutil' => 'phutil',
-  );
-
-  $library_root = phutil_get_library_root($library_names[$project_id]);
-  $project_root = $working_copy->getProjectRoot();
-  if (Filesystem::isDescendant($library_root, $project_root)) {
-    // We're in a copy of arcanist or libphutil, but already loaded the correct
-    // copy. Continue execution normally.
-    return;
-  }
-
-  if ($project_id == 'libphutil') {
-    $console->writeLog(
-      "%s\n",
-      pht('This is libphutil! Forcing this copy to load...'));
-    $original_argv[0] = dirname(phutil_get_library_root('arcanist')).'/bin/arc';
-    $libphutil_path = $project_root;
-  } else {
-    $console->writeLog(
-      "%s\n",
-      pht('This is arcanist! Forcing this copy to run...'));
-    $original_argv[0] = $project_root.'/bin/arc';
-    $libphutil_path = dirname(phutil_get_library_root('phutil'));
-  }
-
-  if (phutil_is_windows()) {
-    $err = phutil_passthru(
-      'set ARC_PHUTIL_PATH=%s & %Ls',
-      $libphutil_path,
-      $original_argv);
-  } else {
-    $err = phutil_passthru(
-      'ARC_PHUTIL_PATH=%s %Ls',
-      $libphutil_path,
-      $original_argv);
-  }
-
-  exit($err);
-}