From d0e47a99aa65afaea33ffafca0d7c93223df61ca Mon Sep 17 00:00:00 2001 From: Shawn Pearce Date: Thu, 16 Jul 2015 14:31:50 -0700 Subject: [PATCH] DFS: Override exactRef() with optimal version This avoids scanning a directory to find all names and then weeding down to the requested name. Change-Id: I36ce31febad6e881182bc3a278c7ed35cc04cbda --- .../eclipse/jgit/internal/storage/dfs/DfsRefDatabase.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsRefDatabase.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsRefDatabase.java index ed8acd578..1d3f007b2 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsRefDatabase.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsRefDatabase.java @@ -90,6 +90,13 @@ public abstract class DfsRefDatabase extends RefDatabase { return 0 < read().size(); } + @Override + public Ref exactRef(String name) throws IOException { + RefCache curr = read(); + Ref ref = curr.ids.get(name); + return ref != null ? resolve(ref, 0, curr.ids) : null; + } + @Override public Ref getRef(String needle) throws IOException { RefCache curr = read();