repository_context.read: drop restriction to current repository

Currently, the read function of the repository context is restricted
to the external repository it is supposed to construct. However,
external repositories are routinely used for configure-like tasks
that inspect a lot of files all over the system and then write a
consolidated descripton of the system to the generated repository. In
fact, even for simple tasks like authentication for http_downloads,
we had to work around that restriction by symlinking the needed
file into the current repository before reading it (followed by
removing the symlink). So simply drop that restriction.

RELNOTES: repository_ctx.read is no longer restricted to files
    in the repository contructed.

Change-Id: I9d5003e00ae2acf9312b7fd65af7a40434933436
PiperOrigin-RevId: 258181706
diff --git a/src/main/java/com/google/devtools/build/lib/bazel/repository/skylark/SkylarkRepositoryContext.java b/src/main/java/com/google/devtools/build/lib/bazel/repository/skylark/SkylarkRepositoryContext.java
index 09f3300..2ed70f6 100644
--- a/src/main/java/com/google/devtools/build/lib/bazel/repository/skylark/SkylarkRepositoryContext.java
+++ b/src/main/java/com/google/devtools/build/lib/bazel/repository/skylark/SkylarkRepositoryContext.java
@@ -331,7 +331,6 @@
         WorkspaceRuleEvent.newReadEvent(p.toString(), rule.getLabel().toString(), location);
     env.getListener().post(w);
     try {
-      checkInOutputDirectory("read", p);
       return FileSystemUtils.readContent(p.getPath(), StandardCharsets.ISO_8859_1);
     } catch (IOException e) {
       throw new RepositoryFunctionException(e, Transience.TRANSIENT);
diff --git a/src/test/java/com/google/devtools/build/lib/bazel/repository/skylark/SkylarkRepositoryContextTest.java b/src/test/java/com/google/devtools/build/lib/bazel/repository/skylark/SkylarkRepositoryContextTest.java
index 85ed571..b174f23 100644
--- a/src/test/java/com/google/devtools/build/lib/bazel/repository/skylark/SkylarkRepositoryContextTest.java
+++ b/src/test/java/com/google/devtools/build/lib/bazel/repository/skylark/SkylarkRepositoryContextTest.java
@@ -251,34 +251,6 @@
 
     String content = context.readFile(context.path("foo/bar"), null);
     assertThat(content).isEqualTo("foobar");
-
-    try {
-      context.readFile(context.path("/absolute"), null);
-      fail("Expected error on reading path outside of the repository directory");
-    } catch (RepositoryFunctionException ex) {
-      assertThat(ex)
-          .hasCauseThat()
-          .hasMessageThat()
-          .isEqualTo("Cannot read outside of the repository directory for path /absolute");
-    }
-    try {
-      context.readFile(context.path("../somepath"), null);
-      fail("Expected error on reading path outside of the repository directory");
-    } catch (RepositoryFunctionException ex) {
-      assertThat(ex)
-          .hasCauseThat()
-          .hasMessageThat()
-          .isEqualTo("Cannot read outside of the repository directory for path /somepath");
-    }
-    try {
-      context.readFile(context.path("foo/../../somepath"), null);
-      fail("Expected error on reading path outside of the repository directory");
-    } catch (RepositoryFunctionException ex) {
-      assertThat(ex)
-          .hasCauseThat()
-          .hasMessageThat()
-          .isEqualTo("Cannot read outside of the repository directory for path /somepath");
-    }
   }
 
   @Test