Speed up indexing existing changes during push
At this point in the code ReceiveCommits only cares about the refs that are under the refs/changes/ name. Scanning only that prefix avoids looking at refs/heads/ or refs/tags/, which may be large if the project has a lot of parallel development activity, or is simply well established and has made many releases. Change-Id: I558f2b40eab4361c34543da2da84b991239833ac Signed-off-by: Shawn O. Pearce <sop@google.com>
This commit is contained in:
@@ -1636,10 +1636,10 @@ public class ReceiveCommits implements PreReceiveHook, PostReceiveHook {
|
||||
sendMergedEmail(result);
|
||||
}
|
||||
|
||||
private Map<ObjectId, Ref> changeRefsById() {
|
||||
private Map<ObjectId, Ref> changeRefsById() throws IOException {
|
||||
if (refsById == null) {
|
||||
refsById = new HashMap<ObjectId, Ref>();
|
||||
for (final Ref r : repo.getAllRefs().values()) {
|
||||
for (Ref r : repo.getRefDatabase().getRefs("refs/changes/").values()) {
|
||||
if (PatchSet.isRef(r.getName())) {
|
||||
refsById.put(r.getObjectId(), r);
|
||||
}
|
||||
|
Reference in New Issue
Block a user