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
This commit is contained in:
parent
39dc898dca
commit
d0e47a99aa
|
@ -90,6 +90,13 @@ boolean exists() throws IOException {
|
|||
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();
|
||||
|
|
Loading…
Reference in New Issue