diff --git a/gerrit-acceptance-tests/src/test/java/com/google/gerrit/acceptance/rest/project/ListBranchesIT.java b/gerrit-acceptance-tests/src/test/java/com/google/gerrit/acceptance/rest/project/ListBranchesIT.java index 6b1973f92d..1b79bc3c7d 100644 --- a/gerrit-acceptance-tests/src/test/java/com/google/gerrit/acceptance/rest/project/ListBranchesIT.java +++ b/gerrit-acceptance-tests/src/test/java/com/google/gerrit/acceptance/rest/project/ListBranchesIT.java @@ -47,7 +47,6 @@ public class ListBranchesIT extends AbstractDaemonTest { @TestProjectInput(createEmptyCommit = false) public void listBranchesOfEmptyProject() throws Exception { assertBranches(ImmutableList.of( - branch("HEAD", null, false), branch("refs/meta/config", null, false)), list().get()); } diff --git a/gerrit-reviewdb/src/main/java/com/google/gerrit/reviewdb/client/RefNames.java b/gerrit-reviewdb/src/main/java/com/google/gerrit/reviewdb/client/RefNames.java index c3bcf312ea..da66929e9c 100644 --- a/gerrit-reviewdb/src/main/java/com/google/gerrit/reviewdb/client/RefNames.java +++ b/gerrit-reviewdb/src/main/java/com/google/gerrit/reviewdb/client/RefNames.java @@ -58,7 +58,7 @@ public class RefNames { public static final String EDIT_PREFIX = "edit-"; public static String fullName(String ref) { - return (ref.startsWith(REFS) ? "" : REFS_HEADS) + ref; + return ref.startsWith(REFS) ? ref : REFS_HEADS + ref; } public static final String shortName(String ref) { diff --git a/gerrit-server/src/main/java/com/google/gerrit/server/ProjectUtil.java b/gerrit-server/src/main/java/com/google/gerrit/server/ProjectUtil.java index d18fe3d602..ad7a7ec583 100644 --- a/gerrit-server/src/main/java/com/google/gerrit/server/ProjectUtil.java +++ b/gerrit-server/src/main/java/com/google/gerrit/server/ProjectUtil.java @@ -41,7 +41,7 @@ public class ProjectUtil { IOException { final Repository repo = repoManager.openRepository(branch.getParentKey()); try { - boolean exists = repo.getRef(branch.get()) != null; + boolean exists = repo.getRefDatabase().exactRef(branch.get()) != null; if (!exists) { exists = repo.getFullBranch().equals(branch.get()); } diff --git a/gerrit-server/src/main/java/com/google/gerrit/server/change/CherryPick.java b/gerrit-server/src/main/java/com/google/gerrit/server/change/CherryPick.java index f4d1e0a3c8..5aaea3e4a1 100644 --- a/gerrit-server/src/main/java/com/google/gerrit/server/change/CherryPick.java +++ b/gerrit-server/src/main/java/com/google/gerrit/server/change/CherryPick.java @@ -24,6 +24,7 @@ import com.google.gerrit.extensions.restapi.ResourceNotFoundException; import com.google.gerrit.extensions.restapi.RestModifyView; import com.google.gerrit.extensions.webui.UiAction; import com.google.gerrit.reviewdb.client.Change; +import com.google.gerrit.reviewdb.client.RefNames; import com.google.gerrit.reviewdb.server.ReviewDb; import com.google.gerrit.server.git.MergeException; import com.google.gerrit.server.project.ChangeControl; @@ -70,11 +71,7 @@ public class CherryPick implements RestModifyView refs; + try { + refs = repo.getRefDatabase().exactRef( + Lists.transform(all, new Function() { + @Override + public String apply(PatchSet ps) { + return ps.getId().toRefName(); + } + }).toArray(new String[all.size()])); + } catch (IOException e) { + error("error reading refs", e); + refs = Collections.emptyMap(); + } + for (PatchSet ps : all) { // Check revision format. int psNum = ps.getId().get(); @@ -256,21 +272,16 @@ public class ConsistencyChecker { // Check ref existence. ProblemInfo refProblem = null; - try { - Ref ref = repo.getRef(refName); - if (ref == null) { - refProblem = problem("Ref missing: " + refName); - } else if (!objId.equals(ref.getObjectId())) { - String actual = ref.getObjectId() != null - ? ref.getObjectId().name() - : "null"; - refProblem = problem(String.format( - "Expected %s to point to %s, found %s", - ref.getName(), objId.name(), actual)); - } - } catch (IOException e) { - error("Error reading ref: " + refName, e); - refProblem = lastProblem(); + Ref ref = refs.get(refName); + if (ref == null) { + refProblem = problem("Ref missing: " + refName); + } else if (!objId.equals(ref.getObjectId())) { + String actual = ref.getObjectId() != null + ? ref.getObjectId().name() + : "null"; + refProblem = problem(String.format( + "Expected %s to point to %s, found %s", + ref.getName(), objId.name(), actual)); } // Check object existence. @@ -306,7 +317,7 @@ public class ConsistencyChecker { String refName = change.getDest().get(); Ref dest; try { - dest = repo.getRef(refName); + dest = repo.getRefDatabase().exactRef(refName); } catch (IOException e) { problem("Failed to look up destination ref: " + refName); return; diff --git a/gerrit-server/src/main/java/com/google/gerrit/server/change/CreateChange.java b/gerrit-server/src/main/java/com/google/gerrit/server/change/CreateChange.java index ac5d3c66d9..c81f93a5b2 100644 --- a/gerrit-server/src/main/java/com/google/gerrit/server/change/CreateChange.java +++ b/gerrit-server/src/main/java/com/google/gerrit/server/change/CreateChange.java @@ -175,7 +175,7 @@ public class CreateChange implements parentCommit = ObjectId.fromString(ps.getRevision().get()); groups = ps.getGroups(); } else { - Ref destRef = git.getRef(refName); + Ref destRef = git.getRefDatabase().exactRef(refName); if (destRef == null) { throw new UnprocessableEntityException(String.format( "Branch %s does not exist.", refName)); diff --git a/gerrit-server/src/main/java/com/google/gerrit/server/change/GetRelatedByAncestors.java b/gerrit-server/src/main/java/com/google/gerrit/server/change/GetRelatedByAncestors.java index 119de7e7d1..09d1ef0a18 100644 --- a/gerrit-server/src/main/java/com/google/gerrit/server/change/GetRelatedByAncestors.java +++ b/gerrit-server/src/main/java/com/google/gerrit/server/change/GetRelatedByAncestors.java @@ -76,7 +76,7 @@ class GetRelatedByAncestors { throws RepositoryNotFoundException, IOException, OrmException { try (Repository git = gitMgr.openRepository(rsrc.getChange().getProject()); RevWalk rw = new RevWalk(git)) { - Ref ref = git.getRef(rsrc.getChange().getDest().get()); + Ref ref = git.getRefDatabase().exactRef(rsrc.getChange().getDest().get()); RelatedInfo info = new RelatedInfo(); info.changes = walk(rsrc, rw, ref); return info; diff --git a/gerrit-server/src/main/java/com/google/gerrit/server/change/Mergeable.java b/gerrit-server/src/main/java/com/google/gerrit/server/change/Mergeable.java index 2653f1bd8f..5e406dd5c5 100644 --- a/gerrit-server/src/main/java/com/google/gerrit/server/change/Mergeable.java +++ b/gerrit-server/src/main/java/com/google/gerrit/server/change/Mergeable.java @@ -47,6 +47,7 @@ import org.slf4j.LoggerFactory; import java.io.IOException; import java.util.ArrayList; +import java.util.Map; import java.util.Objects; public class Mergeable implements RestReadView { @@ -116,7 +117,7 @@ public class Mergeable implements RestReadView { return result; } - Ref ref = git.getRef(change.getDest().get()); + Ref ref = git.getRefDatabase().exactRef(change.getDest().get()); ProjectState projectState = projectCache.get(change.getProject()); String strategy = mergeUtilFactory.create(projectState) .mergeStrategyName(); @@ -135,8 +136,10 @@ public class Mergeable implements RestReadView { BranchOrderSection branchOrder = projectState.getBranchOrderSection(); if (branchOrder != null) { int prefixLen = Constants.R_HEADS.length(); - for (String n : branchOrder.getMoreStable(ref.getName())) { - Ref other = git.getRef(n); + String[] names = branchOrder.getMoreStable(ref.getName()); + Map refs = git.getRefDatabase().exactRef(names); + for (String n : names) { + Ref other = refs.get(n); if (other == null) { continue; } diff --git a/gerrit-server/src/main/java/com/google/gerrit/server/change/RebaseChange.java b/gerrit-server/src/main/java/com/google/gerrit/server/change/RebaseChange.java index 44b0ad398f..27900f7a46 100644 --- a/gerrit-server/src/main/java/com/google/gerrit/server/change/RebaseChange.java +++ b/gerrit-server/src/main/java/com/google/gerrit/server/change/RebaseChange.java @@ -221,7 +221,7 @@ public class RebaseChange { if (baseRev == null) { // We are dependent on a merged PatchSet or have no PatchSet // dependencies at all. - Ref destRef = git.getRef(destBranch.get()); + Ref destRef = git.getRefDatabase().exactRef(destBranch.get()); if (destRef == null) { throw new InvalidChangeOperationException( "The destination branch does not exist: " + destBranch.get()); diff --git a/gerrit-server/src/main/java/com/google/gerrit/server/git/BanCommit.java b/gerrit-server/src/main/java/com/google/gerrit/server/git/BanCommit.java index d8e56b3310..eab2785cca 100644 --- a/gerrit-server/src/main/java/com/google/gerrit/server/git/BanCommit.java +++ b/gerrit-server/src/main/java/com/google/gerrit/server/git/BanCommit.java @@ -59,7 +59,7 @@ public class BanCommit { public static NoteMap loadRejectCommitsMap(Repository repo, RevWalk walk) throws IOException { try { - Ref ref = repo.getRef(RefNames.REFS_REJECT_COMMITS); + Ref ref = repo.getRefDatabase().exactRef(RefNames.REFS_REJECT_COMMITS); if (ref == null) { return NoteMap.newEmptyMap(); } diff --git a/gerrit-server/src/main/java/com/google/gerrit/server/git/BranchOrderSection.java b/gerrit-server/src/main/java/com/google/gerrit/server/git/BranchOrderSection.java index f04434296d..0ef9e0c187 100644 --- a/gerrit-server/src/main/java/com/google/gerrit/server/git/BranchOrderSection.java +++ b/gerrit-server/src/main/java/com/google/gerrit/server/git/BranchOrderSection.java @@ -40,12 +40,12 @@ public class BranchOrderSection { } } - public List getMoreStable(String branch) { + public String[] getMoreStable(String branch) { int i = order.indexOf(RefNames.fullName(branch)); if (0 <= i) { - return order.subList(i + 1, order.size()); - } else { - return ImmutableList.of(); + List r = order.subList(i + 1, order.size()); + return r.toArray(new String[r.size()]); } + return new String[] {}; } } diff --git a/gerrit-server/src/main/java/com/google/gerrit/server/git/NotesBranchUtil.java b/gerrit-server/src/main/java/com/google/gerrit/server/git/NotesBranchUtil.java index fb96a6b5de..2c5e512f81 100644 --- a/gerrit-server/src/main/java/com/google/gerrit/server/git/NotesBranchUtil.java +++ b/gerrit-server/src/main/java/com/google/gerrit/server/git/NotesBranchUtil.java @@ -189,7 +189,7 @@ public class NotesBranchUtil { } private void loadBase(String notesBranch) throws IOException { - Ref branch = db.getRef(notesBranch); + Ref branch = db.getRefDatabase().exactRef(notesBranch); if (branch != null) { baseCommit = revWalk.parseCommit(branch.getObjectId()); base = NoteMap.read(revWalk.getObjectReader(), baseCommit); @@ -240,7 +240,7 @@ public class NotesBranchUtil { } } else { throw new ConcurrentRefUpdateException("Failed to lock the ref: " - + notesBranch, db.getRef(notesBranch), result); + + notesBranch, refUpdate.getRef(), result); } } else if (result == Result.REJECTED) { diff --git a/gerrit-server/src/main/java/com/google/gerrit/server/git/ReceiveCommits.java b/gerrit-server/src/main/java/com/google/gerrit/server/git/ReceiveCommits.java index 123690e0a7..ff2156009d 100644 --- a/gerrit-server/src/main/java/com/google/gerrit/server/git/ReceiveCommits.java +++ b/gerrit-server/src/main/java/com/google/gerrit/server/git/ReceiveCommits.java @@ -1203,10 +1203,8 @@ public class ReceiveCommits { String parse(CmdLineParser clp, Repository repo, Set refs) throws CmdLineException { - String ref = MagicBranch.getDestBranchName(cmd.getRefName()); - if (!ref.startsWith(Constants.R_REFS)) { - ref = Constants.R_HEADS + ref; - } + String ref = RefNames.fullName( + MagicBranch.getDestBranchName(cmd.getRefName())); int optionStart = ref.indexOf('%'); if (0 < optionStart) { @@ -1364,7 +1362,13 @@ public class ReceiveCommits { } else if (newChangeForAllNotInTarget) { String destBranch = magicBranch.dest.get(); try { - ObjectId baseHead = repo.getRef(destBranch).getObjectId(); + Ref r = repo.getRefDatabase().exactRef(destBranch); + if (r == null) { + reject(cmd, destBranch + " not found"); + return; + } + + ObjectId baseHead = r.getObjectId(); magicBranch.baseCommit = Collections.singletonList(walk.parseCommit(baseHead)); } catch (IOException ex) { diff --git a/gerrit-server/src/main/java/com/google/gerrit/server/git/VersionedMetaData.java b/gerrit-server/src/main/java/com/google/gerrit/server/git/VersionedMetaData.java index 37df726726..17f51ef7b6 100644 --- a/gerrit-server/src/main/java/com/google/gerrit/server/git/VersionedMetaData.java +++ b/gerrit-server/src/main/java/com/google/gerrit/server/git/VersionedMetaData.java @@ -96,7 +96,7 @@ public abstract class VersionedMetaData { * @throws ConfigInvalidException */ public void load(Repository db) throws IOException, ConfigInvalidException { - Ref ref = db.getRef(getRefName()); + Ref ref = db.getRefDatabase().exactRef(getRefName()); load(db, ref != null ? ref.getObjectId() : null); } diff --git a/gerrit-server/src/main/java/com/google/gerrit/server/notedb/AbstractChangeNotes.java b/gerrit-server/src/main/java/com/google/gerrit/server/notedb/AbstractChangeNotes.java index 80d45049be..75cf81c16c 100644 --- a/gerrit-server/src/main/java/com/google/gerrit/server/notedb/AbstractChangeNotes.java +++ b/gerrit-server/src/main/java/com/google/gerrit/server/notedb/AbstractChangeNotes.java @@ -81,7 +81,7 @@ public abstract class AbstractChangeNotes extends VersionedMetaData { try { repo = repoManager.openMetadataRepository(getProjectName()); try { - Ref ref = repo.getRef(getRefName()); + Ref ref = repo.getRefDatabase().exactRef(getRefName()); return ref != null ? ref.getObjectId() : null; } finally { repo.close(); diff --git a/gerrit-server/src/main/java/com/google/gerrit/server/notedb/CommentsInNotesUtil.java b/gerrit-server/src/main/java/com/google/gerrit/server/notedb/CommentsInNotesUtil.java index 149325d90b..7f0bee45b9 100644 --- a/gerrit-server/src/main/java/com/google/gerrit/server/notedb/CommentsInNotesUtil.java +++ b/gerrit-server/src/main/java/com/google/gerrit/server/notedb/CommentsInNotesUtil.java @@ -93,7 +93,7 @@ public class CommentsInNotesUtil { Multimap comments, Status status) throws IOException, ConfigInvalidException { - Ref ref = repo.getRef(refName); + Ref ref = repo.getRefDatabase().exactRef(refName); if (ref == null) { return null; } diff --git a/gerrit-server/src/main/java/com/google/gerrit/server/patch/PatchListLoader.java b/gerrit-server/src/main/java/com/google/gerrit/server/patch/PatchListLoader.java index b8caa6244c..f29953cc68 100644 --- a/gerrit-server/src/main/java/com/google/gerrit/server/patch/PatchListLoader.java +++ b/gerrit-server/src/main/java/com/google/gerrit/server/patch/PatchListLoader.java @@ -318,7 +318,7 @@ public class PatchListLoader extends CacheLoader { + hash.substring(0, 2) + "/" + hash.substring(2); - Ref ref = repo.getRef(refName); + Ref ref = repo.getRefDatabase().exactRef(refName); if (ref != null && ref.getObjectId() != null) { return rw.parseTree(ref.getObjectId()); } diff --git a/gerrit-server/src/main/java/com/google/gerrit/server/project/CreateBranch.java b/gerrit-server/src/main/java/com/google/gerrit/server/project/CreateBranch.java index cb94063bda..0c3766d712 100644 --- a/gerrit-server/src/main/java/com/google/gerrit/server/project/CreateBranch.java +++ b/gerrit-server/src/main/java/com/google/gerrit/server/project/CreateBranch.java @@ -154,13 +154,13 @@ public class CreateBranch implements RestModifyView { hooks.doRefUpdatedHook(name, u, identifiedUser.get().getAccount()); break; case LOCK_FAILURE: - if (repo.getRef(ref) != null) { + if (repo.getRefDatabase().exactRef(ref) != null) { throw new ResourceConflictException("branch \"" + ref + "\" already exists"); } String refPrefix = getRefPrefix(ref); while (!Constants.R_HEADS.equals(refPrefix)) { - if (repo.getRef(refPrefix) != null) { + if (repo.getRefDatabase().exactRef(refPrefix) != null) { throw new ResourceConflictException("Cannot create branch \"" + ref + "\" since it conflicts with branch \"" + refPrefix + "\"."); @@ -229,7 +229,7 @@ public class CreateBranch implements RestModifyView { Iterable refs = Iterables.concat( refDb.getRefs(Constants.R_HEADS).values(), refDb.getRefs(Constants.R_TAGS).values()); - Ref rc = refDb.getRef(RefNames.REFS_CONFIG); + Ref rc = refDb.exactRef(RefNames.REFS_CONFIG); if (rc != null) { refs = Iterables.concat(refs, Collections.singleton(rc)); } diff --git a/gerrit-server/src/main/java/com/google/gerrit/server/project/GetHead.java b/gerrit-server/src/main/java/com/google/gerrit/server/project/GetHead.java index 2efd257bcf..f2b5fb8c67 100644 --- a/gerrit-server/src/main/java/com/google/gerrit/server/project/GetHead.java +++ b/gerrit-server/src/main/java/com/google/gerrit/server/project/GetHead.java @@ -50,7 +50,7 @@ public class GetHead implements RestReadView { public String apply(ProjectResource rsrc) throws AuthException, ResourceNotFoundException, IOException { try (Repository repo = repoManager.openRepository(rsrc.getNameKey())) { - Ref head = repo.getRef(Constants.HEAD); + Ref head = repo.getRefDatabase().exactRef(Constants.HEAD); if (head == null) { throw new ResourceNotFoundException(Constants.HEAD); } else if (head.isSymbolic()) { diff --git a/gerrit-server/src/main/java/com/google/gerrit/server/project/ListBranches.java b/gerrit-server/src/main/java/com/google/gerrit/server/project/ListBranches.java index 8195c2a4d6..f7914e9aaa 100644 --- a/gerrit-server/src/main/java/com/google/gerrit/server/project/ListBranches.java +++ b/gerrit-server/src/main/java/com/google/gerrit/server/project/ListBranches.java @@ -115,9 +115,10 @@ public class ListBranches implements RestReadView { db.getRefDatabase().getRefs(Constants.R_HEADS).values(); refs = new ArrayList<>(heads.size() + 3); refs.addAll(heads); - addRef(db, refs, Constants.HEAD); - addRef(db, refs, RefNames.REFS_CONFIG); - addRef(db, refs, RefNames.REFS_USERS_DEFAULT); + refs.addAll(db.getRefDatabase().exactRef( + Constants.HEAD, + RefNames.REFS_CONFIG, + RefNames.REFS_USERS_DEFAULT).values()); } catch (RepositoryNotFoundException noGitRepository) { throw new ResourceNotFoundException(); } @@ -183,14 +184,6 @@ public class ListBranches implements RestReadView { } } - private static void addRef(Repository db, List refs, String name) - throws IOException { - Ref ref = db.getRef(name); - if (ref != null) { - refs.add(ref); - } - } - private FluentIterable filterBranches( FluentIterable branches) throws BadRequestException { if (!Strings.isNullOrEmpty(matchSubstring)) { diff --git a/gerrit-server/src/main/java/com/google/gerrit/server/project/ListProjects.java b/gerrit-server/src/main/java/com/google/gerrit/server/project/ListProjects.java index 2d8757eb64..70613dc8a6 100644 --- a/gerrit-server/src/main/java/com/google/gerrit/server/project/ListProjects.java +++ b/gerrit-server/src/main/java/com/google/gerrit/server/project/ListProjects.java @@ -91,7 +91,7 @@ public class ListProjects implements RestReadView { PERMISSIONS { @Override boolean matches(Repository git) throws IOException { - Ref head = git.getRef(Constants.HEAD); + Ref head = git.getRefDatabase().exactRef(Constants.HEAD); return head != null && head.isSymbolic() && RefNames.REFS_CONFIG.equals(head.getLeaf().getName()); diff --git a/gerrit-server/src/main/java/com/google/gerrit/server/project/ListTags.java b/gerrit-server/src/main/java/com/google/gerrit/server/project/ListTags.java index b01e563e1e..6a76a69c69 100644 --- a/gerrit-server/src/main/java/com/google/gerrit/server/project/ListTags.java +++ b/gerrit-server/src/main/java/com/google/gerrit/server/project/ListTags.java @@ -104,7 +104,7 @@ public class ListTags implements RestReadView { if (!tagName.startsWith(Constants.R_TAGS)) { tagName = Constants.R_TAGS + tagName; } - Ref ref = repo.getRefDatabase().getRef(tagName); + Ref ref = repo.getRefDatabase().exactRef(tagName); if (ref != null && !visibleTags(resource.getControl(), repo, ImmutableMap.of(ref.getName(), ref)).isEmpty()) { return createTagInfo(ref, rw); diff --git a/gerrit-server/src/main/java/com/google/gerrit/server/project/ProjectState.java b/gerrit-server/src/main/java/com/google/gerrit/server/project/ProjectState.java index 10b64a0103..128da4ae0c 100644 --- a/gerrit-server/src/main/java/com/google/gerrit/server/project/ProjectState.java +++ b/gerrit-server/src/main/java/com/google/gerrit/server/project/ProjectState.java @@ -166,7 +166,7 @@ public class ProjectState { try { Repository git = gitMgr.openRepository(getProject().getNameKey()); try { - Ref ref = git.getRef(RefNames.REFS_CONFIG); + Ref ref = git.getRefDatabase().exactRef(RefNames.REFS_CONFIG); if (ref == null || ref.getObjectId() == null) { return true; } diff --git a/gerrit-server/src/main/java/com/google/gerrit/server/project/SetHead.java b/gerrit-server/src/main/java/com/google/gerrit/server/project/SetHead.java index 07c0162522..2e5082c924 100644 --- a/gerrit-server/src/main/java/com/google/gerrit/server/project/SetHead.java +++ b/gerrit-server/src/main/java/com/google/gerrit/server/project/SetHead.java @@ -33,12 +33,14 @@ import com.google.inject.Singleton; import org.eclipse.jgit.errors.RepositoryNotFoundException; import org.eclipse.jgit.lib.Constants; +import org.eclipse.jgit.lib.Ref; import org.eclipse.jgit.lib.RefUpdate; import org.eclipse.jgit.lib.Repository; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.io.IOException; +import java.util.Map; @Singleton public class SetHead implements RestModifyView { @@ -77,12 +79,14 @@ public class SetHead implements RestModifyView { Repository repo = null; try { repo = repoManager.openRepository(rsrc.getNameKey()); - if (repo.getRef(ref) == null) { + Map cur = + repo.getRefDatabase().exactRef(Constants.HEAD, ref); + if (!cur.containsKey(ref)) { throw new UnprocessableEntityException(String.format( "Ref Not Found: %s", ref)); } - final String oldHead = repo.getRef(Constants.HEAD).getTarget().getName(); + final String oldHead = cur.get(Constants.HEAD).getTarget().getName(); final String newHead = ref; if (!oldHead.equals(newHead)) { final RefUpdate u = repo.updateRef(Constants.HEAD, true); diff --git a/gerrit-server/src/main/java/com/google/gerrit/server/query/change/ChangeData.java b/gerrit-server/src/main/java/com/google/gerrit/server/query/change/ChangeData.java index 3dcdc14aa5..0523d73fdc 100644 --- a/gerrit-server/src/main/java/com/google/gerrit/server/query/change/ChangeData.java +++ b/gerrit-server/src/main/java/com/google/gerrit/server/query/change/ChangeData.java @@ -730,7 +730,7 @@ public class ChangeData { return null; } try (Repository repo = repoManager.openRepository(c.getProject())) { - Ref ref = repo.getRef(c.getDest().get()); + Ref ref = repo.getRefDatabase().exactRef(c.getDest().get()); SubmitTypeRecord rec = new SubmitRuleEvaluator(this) .getSubmitType(); if (rec.status != SubmitTypeRecord.Status.OK) {