]> khamidou — GitHub mirrors - arcanist.git/commitdiff
Resolve paths when running "--lintall"
authorepriestley <epriestley@phabricator.com>
Mon, 14 Mar 2011 22:03:50 +0000 (15:03 -0700)
committerepriestley <epriestley@phabricator.com>
Wed, 16 Mar 2011 01:59:48 +0000 (18:59 -0700)
Summary: this was all kinds of fail when running from a subdirectory or on
invalid paths. Detect nonexistent paths; resolve valid paths.

Test Plan: ran "arc lint --lintall" on a file from a subdirectory, and on a
file which did not exist. Received patches and an error, respectively

Reviewers: arudolph

CC:

Differential Revision: 72

src/workflow/lint/ArcanistLintWorkflow.php

index a6cc812afa978465d345e316b4bbcb65a46646fc..a030a950da8f24fa772737c1712a89ab8efee3b0 100644 (file)
@@ -139,6 +139,16 @@ EOTEXT
         throw new ArcanistUsageException(
           "You must specify one or more files to lint when using '--lintall'.");
       }
+      foreach ($paths as $key => $path) {
+        $full_path = Filesystem::resolvePath($path);
+        if (!Filesystem::pathExists($full_path)) {
+          throw new ArcanistUsageException("Path '{$path}' does not exist!");
+        }
+        $relative_path = Filesystem::readablePath(
+          $full_path,
+          $working_copy->getProjectRoot());
+        $paths[$key] = $relative_path;
+      }
     }
 
     if (!$engine) {