Make the magic refs/heads/ constant available in GWT
JGit defines Constants.R_HEADS to be "refs/heads/" but we don't
have JGit's source code in our build path, so GWT can't use that
constant here in Branch. It also can't process the Constants in
JGit as that class contains references to types that GWT lacks,
even though that would all strip out anyway during the build (as
it is never called). So we duplicate these simple definitions.
Signed-off-by: Shawn O. Pearce <sop@google.com>
diff --git a/src/main/java/com/google/gerrit/client/reviewdb/Branch.java b/src/main/java/com/google/gerrit/client/reviewdb/Branch.java
index 98e7282..4d45838 100644
--- a/src/main/java/com/google/gerrit/client/reviewdb/Branch.java
+++ b/src/main/java/com/google/gerrit/client/reviewdb/Branch.java
@@ -20,6 +20,9 @@
/** Registered line of development within a {@link Project}. */
public final class Branch {
+ public static final String R_HEADS = "refs/heads/";
+ public static final String R_REFS = "refs/";
+
/** Branch name key */
public static class NameKey extends StringKey<Project.NameKey> {
@Column
@@ -57,8 +60,8 @@
// Git style branches will tend to start with "refs/heads/".
//
- if (n.startsWith("refs/heads/")) {
- return n.substring("refs/heads/".length());
+ if (n.startsWith(R_HEADS)) {
+ return n.substring(R_HEADS.length());
}
return n;