From 67032569dc676bd169e070a5b63accb8c78dec83 Mon Sep 17 00:00:00 2001 From: Kristina Chodorow Date: Mon, 29 Jun 2015 13:53:20 +0000 Subject: Allow / in repository names -- MOS_MIGRATED_REVID=97125970 --- .../devtools/build/lib/packages/PackageIdentifier.java | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'src/main/java/com/google') diff --git a/src/main/java/com/google/devtools/build/lib/packages/PackageIdentifier.java b/src/main/java/com/google/devtools/build/lib/packages/PackageIdentifier.java index 8f5d45b748..f2f5b8e0e0 100644 --- a/src/main/java/com/google/devtools/build/lib/packages/PackageIdentifier.java +++ b/src/main/java/com/google/devtools/build/lib/packages/PackageIdentifier.java @@ -82,14 +82,20 @@ public final class PackageIdentifier implements Comparable, S return "empty workspace name"; } - // Check for any character outside of [/0-9A-Z_a-z-]. Try to evaluate the + // Check for any character outside of [/0-9A-Z_a-z-._]. Try to evaluate the // conditional quickly (by looking in decreasing order of character class // likelihood). + if (name.startsWith("@/") || name.endsWith("/")) { + return "workspace names cannot start nor end with '/'"; + } else if (name.contains("//")) { + return "workspace names cannot contain multiple '/'s in a row"; + } + for (int i = name.length() - 1; i >= 1; --i) { char c = name.charAt(i); - if ((c < 'a' || c > 'z') && c != '_' && c != '-' + if ((c < 'a' || c > 'z') && c != '_' && c != '-' && c != '/' && c != '.' && (c < '0' || c > '9') && (c < 'A' || c > 'Z')) { - return "workspace names may contain only A-Z, a-z, 0-9, '-' and '_'"; + return "workspace names may contain only A-Z, a-z, 0-9, '-', '_', '.', and '/'"; } } return null; -- cgit v1.2.3