Use RootedPath.getParentDirectory in FileFunction. We get the RootedPath to the parent folder by getting the parent PathFragment and creating a RootedPath from that. RootedPath does exactly the same thing -- use the helper instead. RELNOTES: None. PiperOrigin-RevId: 278398153
diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/FileFunction.java b/src/main/java/com/google/devtools/build/lib/skyframe/FileFunction.java index 89d98f0..bae2c18 100644 --- a/src/main/java/com/google/devtools/build/lib/skyframe/FileFunction.java +++ b/src/main/java/com/google/devtools/build/lib/skyframe/FileFunction.java
@@ -161,17 +161,17 @@ ArrayList<RootedPath> logicalChain, Environment env) throws InterruptedException, FileFunctionException { - PathFragment parentDirectory = rootedPath.getRootRelativePath().getParentDirectory(); - return parentDirectory != null + RootedPath parentRootedPath = rootedPath.getParentDirectory(); + return parentRootedPath != null ? resolveFromAncestorsWithParent( - rootedPath, parentDirectory, sortedLogicalChain, logicalChain, env) + rootedPath, parentRootedPath, sortedLogicalChain, logicalChain, env) : resolveFromAncestorsNoParent(rootedPath, sortedLogicalChain, logicalChain, env); } @Nullable private PartialResolutionResult resolveFromAncestorsWithParent( RootedPath rootedPath, - PathFragment parentDirectory, + RootedPath parentRootedPath, TreeSet<Path> sortedLogicalChain, ArrayList<RootedPath> logicalChain, Environment env) @@ -179,7 +179,6 @@ PathFragment relativePath = rootedPath.getRootRelativePath(); RootedPath rootedPathFromAncestors; String baseName = relativePath.getBaseName(); - RootedPath parentRootedPath = RootedPath.toRootedPath(rootedPath.getRoot(), parentDirectory); FileValue parentFileValue = (FileValue) env.getValue(FileValue.key(parentRootedPath)); if (parentFileValue == null) {