Fix trivial usages of deprecated RefDatabase.getRefs method

getRefs(String) returns Map<String, Ref>; most callers only call its
values() method and iterate over the list of Ref objects. It's trivial
to replace those calls with getRefsByPrefix which returns a List<Ref>.

Change-Id: Iad142ea8a0dec69b22fcec084bb66eafd79c2a0d
This commit is contained in:
David Pursehouse
2018-06-01 19:55:16 +09:00
parent 895d678b4f
commit f717f06986
26 changed files with 34 additions and 40 deletions

View File

@@ -38,7 +38,6 @@ import java.util.Map;
import org.eclipse.jgit.errors.TooLargeObjectInPackException;
import org.eclipse.jgit.errors.UnpackException;
import org.eclipse.jgit.lib.Ref;
import org.eclipse.jgit.lib.RefDatabase;
import org.eclipse.jgit.transport.AdvertiseRefsHook;
import org.eclipse.jgit.transport.ReceivePack;
import org.kohsuke.args4j.Option;
@@ -148,9 +147,9 @@ final class Receive extends AbstractGitCommand {
.append("\n");
}
Map<String, Ref> allRefs = rp.getRepository().getRefDatabase().getRefs(RefDatabase.ALL);
List<Ref> allRefs = rp.getRepository().getRefDatabase().getRefs();
List<Ref> hidden = new ArrayList<>();
for (Ref ref : allRefs.values()) {
for (Ref ref : allRefs) {
if (!adv.containsKey(ref.getName())) {
hidden.add(ref);
}