Browse Source

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
stable-4.1
Shawn Pearce 9 years ago
parent
commit
d0e47a99aa
  1. 7
      org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsRefDatabase.java

7
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(); 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 @Override
public Ref getRef(String needle) throws IOException { public Ref getRef(String needle) throws IOException {
RefCache curr = read(); RefCache curr = read();

Loading…
Cancel
Save