Page MenuHomePhabricator

Allow Filesystem::walkToRoot() to operate on fictional paths
ClosedPublic

Authored by epriestley on Oct 4 2015, 2:17 PM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, Apr 25, 12:52 AM
Unknown Object (File)
Mon, Apr 22, 8:34 PM
Unknown Object (File)
Sun, Apr 14, 9:54 AM
Unknown Object (File)
Thu, Apr 11, 8:38 AM
Unknown Object (File)
Thu, Apr 11, 7:34 AM
Unknown Object (File)
Thu, Apr 11, 7:34 AM
Unknown Object (File)
Mon, Apr 8, 9:37 AM
Unknown Object (File)
Mon, Apr 1, 2:49 PM
Subscribers
None

Details

Summary

This is part of fixing a unit test in arc, but generally seems like a reasonable/desirable behavior.

If you have a path like /x/y/z, where the path is fictional and none of the components actually exist:

  • Prior to D13202, we'd walk "/x/y/z" -> "/x/y/" -> "/x" -> "/".
  • After D13202, the isDescendant() check rejects this and we don't walk anywhere. We also never hit "/".
  • After this diff, walk it again.

The old behavior seems reasonable to me.

Test Plan

Added a unit test, ran unit tests. See next revision (test in arc) for additional context.

Diff Detail

Repository
rPHU libphutil
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

epriestley retitled this revision from to Allow Filesystem::walkToRoot() to operate on fictional paths.
epriestley updated this object.
epriestley edited the test plan for this revision. (Show Details)
epriestley added reviewers: chad, joshuaspence.
  • Also walk to "/", which we previously did not.

This completely fixes the test in arc so there's actually no second diff, but here was the failure:

   FAIL  PhpunitTestEngineTestCase::testSearchLocations
Assertion failed, expected values to be equal (at PhpunitTestEngineTestCase.php:39).
Expected vs Actual Output Diff
--- Old Value
+++ New Value
@@ -1,29 +1,21 @@
 Array
 (
     [0] => /path/to/some/file/
-    [1] => /path/to/some/file/tests/
-    [2] => /path/to/some/file/Tests/
-    [3] => /path/to/some/tests/
-    [4] => /path/to/some/Tests/
-    [5] => /path/to/tests/
-    [6] => /path/to/Tests/
-    [7] => /path/tests/
-    [8] => /path/Tests/
-    [9] => /tests/
-    [10] => /Tests/
-    [11] => /path/to/tests/file/
-    [12] => /path/to/Tests/file/
-    [13] => /path/tests/some/file/
-    [14] => /path/Tests/some/file/
-    [15] => /tests/to/some/file/
-    [16] => /Tests/to/some/file/
-    [17] => /path/to/some/tests/file/
-    [18] => /path/to/some/Tests/file/
-    [19] => /path/to/tests/some/file/
-    [20] => /path/to/Tests/some/file/
-    [21] => /path/tests/to/some/file/
-    [22] => /path/Tests/to/some/file/
-    [23] => /tests/path/to/some/file/
-    [24] => /Tests/path/to/some/file/
+    [1] => /path/to/some/tests/
+    [2] => /path/to/some/Tests/
+    [3] => /path/to/tests/file/
+    [4] => /path/to/Tests/file/
+    [5] => /path/tests/some/file/
+    [6] => /path/Tests/some/file/
+    [7] => /tests/to/some/file/
+    [8] => /Tests/to/some/file/
+    [9] => /path/to/some/tests/file/
+    [10] => /path/to/some/Tests/file/
+    [11] => /path/to/tests/some/file/
+    [12] => /path/to/Tests/some/file/
+    [13] => /path/tests/to/some/file/
+    [14] => /path/Tests/to/some/file/
+    [15] => /tests/path/to/some/file/
+    [16] => /Tests/path/to/some/file/
 )

All paths except /tests/ and /Tests/ were failing because Filesystem::walkToRoot() no longer walked them (since they do not exist).

The /tests/ and /Tests/ paths were failing because Filesystem::walkToRoot() no longer walked "/".

chad edited edge metadata.
This revision is now accepted and ready to land.Oct 4 2015, 2:38 PM
This revision was automatically updated to reflect the committed changes.