Replace non-trivial uses of RefDatabase.getRefs with getRefsByPrefix
getRefs returns Map<String, Ref> where the key is the ref name with the given prefix stripped off. However, getRefsByPrefix returns a list of Refs with the full refname. Therefore, when converting to getRefsByPrefix, we have to explicitly remove the ref prefix from each ref name before using it. Change-Id: I9a3ecf942ea47325fffa27596265fde217c2af0c
This commit is contained in:
@@ -296,7 +296,11 @@ public class StarredChangesUtil {
|
||||
|
||||
private static Set<String> getRefNames(Repository repo, String prefix) throws IOException {
|
||||
RefDatabase refDb = repo.getRefDatabase();
|
||||
return refDb.getRefs(prefix).keySet();
|
||||
return refDb
|
||||
.getRefsByPrefix(prefix)
|
||||
.stream()
|
||||
.map(r -> r.getName().substring(prefix.length()))
|
||||
.collect(toSet());
|
||||
}
|
||||
|
||||
public ObjectId getObjectId(Account.Id accountId, Change.Id changeId) {
|
||||
|
Reference in New Issue
Block a user