diff options
Diffstat (limited to 'java/com/google/gerrit/reviewdb/client/RefNames.java')
-rw-r--r-- | java/com/google/gerrit/reviewdb/client/RefNames.java | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/java/com/google/gerrit/reviewdb/client/RefNames.java b/java/com/google/gerrit/reviewdb/client/RefNames.java index 1f119218c8..984e43e925 100644 --- a/java/com/google/gerrit/reviewdb/client/RefNames.java +++ b/java/com/google/gerrit/reviewdb/client/RefNames.java @@ -123,6 +123,11 @@ public class RefNames { return shard(id.get(), r).append(META_SUFFIX).toString(); } + public static String patchSetRef(PatchSet.Id id) { + StringBuilder r = newStringBuilder().append(REFS_CHANGES); + return shard(id.changeId().get(), r).append('/').append(id.get()).toString(); + } + public static String robotCommentsRef(Change.Id id) { StringBuilder r = newStringBuilder().append(REFS_CHANGES); return shard(id.get(), r).append(ROBOT_COMMENTS_SUFFIX).toString(); @@ -278,10 +283,16 @@ public class RefNames { * Whether the ref is managed by Gerrit. Covers all Gerrit-internal refs like refs/cache-automerge * and refs/meta as well as refs/changes. Does not cover user-created refs like branches or custom * ref namespaces like refs/my-company. + * + * <p>Any ref for which this method evaluates to true will be served to users who have the {@code + * ACCESS_DATABASE} capability. + * + * <p><b>Caution</b>Any ref not in this list will be served if the user was granted a READ + * permission on it using Gerrit's permission model. */ public static boolean isGerritRef(String ref) { return ref.startsWith(REFS_CHANGES) - || ref.startsWith(REFS_META) + || ref.startsWith(REFS_EXTERNAL_IDS) || ref.startsWith(REFS_CACHE_AUTOMERGE) || ref.startsWith(REFS_DRAFT_COMMENTS) || ref.startsWith(REFS_DELETED_GROUPS) @@ -289,7 +300,8 @@ public class RefNames { || ref.startsWith(REFS_GROUPS) || ref.startsWith(REFS_GROUPNAMES) || ref.startsWith(REFS_USERS) - || ref.startsWith(REFS_STARRED_CHANGES); + || ref.startsWith(REFS_STARRED_CHANGES) + || ref.startsWith(REFS_REJECT_COMMITS); } static Integer parseShardedRefPart(String name) { |