Remove trivial cases of using deprecated RefDatabase.getRefs()
Change-Id: I2d3e426a3391923f8a690ac68fcc33851f3eb419 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
This commit is contained in:
parent
f26d6558f8
commit
9edf9bf2d6
|
@ -174,8 +174,8 @@ private static LfsPointer loadLfsPointer(ObjectReader r, AnyObjectId obj)
|
||||||
|
|
||||||
private void excludeRemoteRefs(ObjectWalk walk) throws IOException {
|
private void excludeRemoteRefs(ObjectWalk walk) throws IOException {
|
||||||
RefDatabase refDatabase = getRepository().getRefDatabase();
|
RefDatabase refDatabase = getRepository().getRefDatabase();
|
||||||
Map<String, Ref> remoteRefs = refDatabase.getRefs(remote());
|
List<Ref> remoteRefs = refDatabase.getRefsByPrefix(remote());
|
||||||
for (Ref r : remoteRefs.values()) {
|
for (Ref r : remoteRefs) {
|
||||||
ObjectId oid = r.getPeeledObjectId();
|
ObjectId oid = r.getPeeledObjectId();
|
||||||
if (oid == null) {
|
if (oid == null) {
|
||||||
oid = r.getObjectId();
|
oid = r.getObjectId();
|
||||||
|
|
|
@ -49,7 +49,6 @@
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import org.eclipse.jgit.lib.ObjectId;
|
import org.eclipse.jgit.lib.ObjectId;
|
||||||
import org.eclipse.jgit.lib.Ref;
|
import org.eclipse.jgit.lib.Ref;
|
||||||
|
@ -74,8 +73,8 @@ class RevParse extends TextBuiltin {
|
||||||
@Override
|
@Override
|
||||||
protected void run() throws Exception {
|
protected void run() throws Exception {
|
||||||
if (all) {
|
if (all) {
|
||||||
Map<String, Ref> allRefs = db.getRefDatabase().getRefs(ALL);
|
List<Ref> allRefs = db.getRefDatabase().getRefsByPrefix(ALL);
|
||||||
for (final Ref r : allRefs.values()) {
|
for (final Ref r : allRefs) {
|
||||||
ObjectId objectId = r.getObjectId();
|
ObjectId objectId = r.getObjectId();
|
||||||
// getRefs skips dangling symrefs, so objectId should never be
|
// getRefs skips dangling symrefs, so objectId should never be
|
||||||
// null.
|
// null.
|
||||||
|
|
|
@ -47,7 +47,6 @@
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.EnumSet;
|
import java.util.EnumSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import org.eclipse.jgit.diff.DiffConfig;
|
import org.eclipse.jgit.diff.DiffConfig;
|
||||||
import org.eclipse.jgit.errors.IncorrectObjectTypeException;
|
import org.eclipse.jgit.errors.IncorrectObjectTypeException;
|
||||||
|
@ -171,9 +170,9 @@ else if (revLimiter.size() > 1)
|
||||||
walk.setRevFilter(AndRevFilter.create(revLimiter));
|
walk.setRevFilter(AndRevFilter.create(revLimiter));
|
||||||
|
|
||||||
if (all) {
|
if (all) {
|
||||||
Map<String, Ref> refs =
|
List<Ref> refs =
|
||||||
db.getRefDatabase().getRefs(RefDatabase.ALL);
|
db.getRefDatabase().getRefsByPrefix(RefDatabase.ALL);
|
||||||
for (Ref a : refs.values()) {
|
for (Ref a : refs) {
|
||||||
ObjectId oid = a.getPeeledObjectId();
|
ObjectId oid = a.getPeeledObjectId();
|
||||||
if (oid == null)
|
if (oid == null)
|
||||||
oid = a.getObjectId();
|
oid = a.getObjectId();
|
||||||
|
|
|
@ -48,13 +48,11 @@
|
||||||
import static org.eclipse.jgit.lib.RefDatabase.ALL;
|
import static org.eclipse.jgit.lib.RefDatabase.ALL;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.Map;
|
import java.util.List;
|
||||||
import java.util.SortedMap;
|
|
||||||
|
|
||||||
import org.eclipse.jgit.lib.AnyObjectId;
|
import org.eclipse.jgit.lib.AnyObjectId;
|
||||||
import org.eclipse.jgit.lib.Ref;
|
import org.eclipse.jgit.lib.Ref;
|
||||||
import org.eclipse.jgit.lib.RefComparator;
|
import org.eclipse.jgit.lib.RefComparator;
|
||||||
import org.eclipse.jgit.util.RefMap;
|
|
||||||
|
|
||||||
@Command(usage = "usage_ShowRef")
|
@Command(usage = "usage_ShowRef")
|
||||||
class ShowRef extends TextBuiltin {
|
class ShowRef extends TextBuiltin {
|
||||||
|
@ -69,11 +67,10 @@ protected void run() throws Exception {
|
||||||
}
|
}
|
||||||
|
|
||||||
private Iterable<Ref> getSortedRefs() throws Exception {
|
private Iterable<Ref> getSortedRefs() throws Exception {
|
||||||
Map<String, Ref> all = db.getRefDatabase().getRefs(ALL);
|
List<Ref> all = db.getRefDatabase().getRefsByPrefix(ALL);
|
||||||
if (all instanceof RefMap
|
// TODO(jrn) check if we can reintroduce fast-path by e.g. implementing
|
||||||
|| (all instanceof SortedMap && ((SortedMap) all).comparator() == null))
|
// SortedList
|
||||||
return all.values();
|
return RefComparator.sort(all);
|
||||||
return RefComparator.sort(all.values());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void show(final AnyObjectId id, final String name)
|
private void show(final AnyObjectId id, final String name)
|
||||||
|
|
|
@ -117,7 +117,7 @@ class RebuildCommitGraph extends TextBuiltin {
|
||||||
/** {@inheritDoc} */
|
/** {@inheritDoc} */
|
||||||
@Override
|
@Override
|
||||||
protected void run() throws Exception {
|
protected void run() throws Exception {
|
||||||
if (!really && !db.getRefDatabase().getRefs(ALL).isEmpty()) {
|
if (!really && !db.getRefDatabase().getRefsByPrefix(ALL).isEmpty()) {
|
||||||
File directory = db.getDirectory();
|
File directory = db.getDirectory();
|
||||||
String absolutePath = directory == null ? "null" //$NON-NLS-1$
|
String absolutePath = directory == null ? "null" //$NON-NLS-1$
|
||||||
: directory.getAbsolutePath();
|
: directory.getAbsolutePath();
|
||||||
|
@ -247,8 +247,8 @@ private void detachHead() throws IOException {
|
||||||
|
|
||||||
private void deleteAllRefs() throws Exception {
|
private void deleteAllRefs() throws Exception {
|
||||||
final RevWalk rw = new RevWalk(db);
|
final RevWalk rw = new RevWalk(db);
|
||||||
Map<String, Ref> refs = db.getRefDatabase().getRefs(ALL);
|
List<Ref> refs = db.getRefDatabase().getRefsByPrefix(ALL);
|
||||||
for (final Ref r : refs.values()) {
|
for (final Ref r : refs) {
|
||||||
if (Constants.HEAD.equals(r.getName()))
|
if (Constants.HEAD.equals(r.getName()))
|
||||||
continue;
|
continue;
|
||||||
final RefUpdate u = db.updateRef(r.getName());
|
final RefUpdate u = db.updateRef(r.getName());
|
||||||
|
|
|
@ -154,7 +154,7 @@ private RefTree rebuild(RefDatabase refdb) throws IOException {
|
||||||
head));
|
head));
|
||||||
}
|
}
|
||||||
|
|
||||||
for (Ref r : refdb.getRefs(RefDatabase.ALL).values()) {
|
for (Ref r : refdb.getRefsByPrefix(RefDatabase.ALL)) {
|
||||||
if (r.getName().equals(txnCommitted) || r.getName().equals(HEAD)
|
if (r.getName().equals(txnCommitted) || r.getName().equals(HEAD)
|
||||||
|| r.getName().startsWith(txnNamespace)) {
|
|| r.getName().startsWith(txnNamespace)) {
|
||||||
continue;
|
continue;
|
||||||
|
|
|
@ -1271,7 +1271,7 @@ public void testRefsChangedStackOverflow() throws Exception {
|
||||||
@Override
|
@Override
|
||||||
public void onRefsChanged(RefsChangedEvent event) {
|
public void onRefsChanged(RefsChangedEvent event) {
|
||||||
try {
|
try {
|
||||||
refDb.getRefs("ref");
|
refDb.getRefsByPrefix("ref");
|
||||||
changeCount.incrementAndGet();
|
changeCount.incrementAndGet();
|
||||||
} catch (StackOverflowError soe) {
|
} catch (StackOverflowError soe) {
|
||||||
error.set(soe);
|
error.set(soe);
|
||||||
|
@ -1280,8 +1280,8 @@ public void onRefsChanged(RefsChangedEvent event) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
refDb.getRefs("ref");
|
refDb.getRefsByPrefix("ref");
|
||||||
refDb.getRefs("ref");
|
refDb.getRefsByPrefix("ref");
|
||||||
assertNull(error.get());
|
assertNull(error.get());
|
||||||
assertNull(exception.get());
|
assertNull(exception.get());
|
||||||
assertEquals(1, changeCount.get());
|
assertEquals(1, changeCount.get());
|
||||||
|
|
|
@ -246,7 +246,8 @@ public String call() throws GitAPIException {
|
||||||
if (target == null)
|
if (target == null)
|
||||||
setTarget(Constants.HEAD);
|
setTarget(Constants.HEAD);
|
||||||
|
|
||||||
Collection<Ref> tagList = repo.getRefDatabase().getRefs(R_TAGS).values();
|
Collection<Ref> tagList = repo.getRefDatabase()
|
||||||
|
.getRefsByPrefix(R_TAGS);
|
||||||
Map<ObjectId, List<Ref>> tags = tagList.stream()
|
Map<ObjectId, List<Ref>> tags = tagList.stream()
|
||||||
.collect(Collectors.groupingBy(this::getObjectIdFromRef));
|
.collect(Collectors.groupingBy(this::getObjectIdFromRef));
|
||||||
|
|
||||||
|
|
|
@ -187,6 +187,6 @@ public ListBranchCommand setContains(String containsCommitish) {
|
||||||
}
|
}
|
||||||
|
|
||||||
private Collection<Ref> getRefs(String prefix) throws IOException {
|
private Collection<Ref> getRefs(String prefix) throws IOException {
|
||||||
return repo.getRefDatabase().getRefs(prefix).values();
|
return repo.getRefDatabase().getRefsByPrefix(prefix);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -47,7 +47,6 @@
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import org.eclipse.jgit.api.errors.GitAPIException;
|
import org.eclipse.jgit.api.errors.GitAPIException;
|
||||||
import org.eclipse.jgit.api.errors.JGitInternalException;
|
import org.eclipse.jgit.api.errors.JGitInternalException;
|
||||||
|
@ -78,11 +77,11 @@ protected ListTagCommand(Repository repo) {
|
||||||
@Override
|
@Override
|
||||||
public List<Ref> call() throws GitAPIException {
|
public List<Ref> call() throws GitAPIException {
|
||||||
checkCallable();
|
checkCallable();
|
||||||
Map<String, Ref> refList;
|
|
||||||
List<Ref> tags = new ArrayList<>();
|
List<Ref> tags = new ArrayList<>();
|
||||||
try (RevWalk revWalk = new RevWalk(repo)) {
|
try (RevWalk revWalk = new RevWalk(repo)) {
|
||||||
refList = repo.getRefDatabase().getRefs(Constants.R_TAGS);
|
List<Ref> refList = repo.getRefDatabase()
|
||||||
for (Ref ref : refList.values()) {
|
.getRefsByPrefix(Constants.R_TAGS);
|
||||||
|
for (Ref ref : refList) {
|
||||||
tags.add(ref);
|
tags.add(ref);
|
||||||
}
|
}
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
|
|
|
@ -48,7 +48,6 @@
|
||||||
import java.text.MessageFormat;
|
import java.text.MessageFormat;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import org.eclipse.jgit.api.errors.GitAPIException;
|
import org.eclipse.jgit.api.errors.GitAPIException;
|
||||||
import org.eclipse.jgit.api.errors.JGitInternalException;
|
import org.eclipse.jgit.api.errors.JGitInternalException;
|
||||||
|
@ -275,8 +274,8 @@ public LogCommand addRange(AnyObjectId since, AnyObjectId until)
|
||||||
* the references could not be accessed
|
* the references could not be accessed
|
||||||
*/
|
*/
|
||||||
public LogCommand all() throws IOException {
|
public LogCommand all() throws IOException {
|
||||||
Map<String, Ref> refs = getRepository().getRefDatabase().getRefs(ALL);
|
List<Ref> refs = getRepository().getRefDatabase().getRefsByPrefix(ALL);
|
||||||
for (Ref ref : refs.values()) {
|
for (Ref ref : refs) {
|
||||||
if(!ref.isPeeled())
|
if(!ref.isPeeled())
|
||||||
ref = getRepository().peel(ref);
|
ref = getRepository().peel(ref);
|
||||||
|
|
||||||
|
|
|
@ -278,7 +278,8 @@ public NameRevCommand addAnnotatedTags() {
|
||||||
if (refs == null)
|
if (refs == null)
|
||||||
refs = new ArrayList<>();
|
refs = new ArrayList<>();
|
||||||
try {
|
try {
|
||||||
for (Ref ref : repo.getRefDatabase().getRefs(Constants.R_TAGS).values()) {
|
for (Ref ref : repo.getRefDatabase()
|
||||||
|
.getRefsByPrefix(Constants.R_TAGS)) {
|
||||||
ObjectId id = ref.getObjectId();
|
ObjectId id = ref.getObjectId();
|
||||||
if (id != null && (walk.parseAny(id) instanceof RevTag))
|
if (id != null && (walk.parseAny(id) instanceof RevTag))
|
||||||
addRef(ref);
|
addRef(ref);
|
||||||
|
@ -324,7 +325,7 @@ private void addPrefixes(Map<ObjectId, String> nonCommits,
|
||||||
|
|
||||||
private void addPrefix(String prefix, Map<ObjectId, String> nonCommits,
|
private void addPrefix(String prefix, Map<ObjectId, String> nonCommits,
|
||||||
FIFORevQueue pending) throws IOException {
|
FIFORevQueue pending) throws IOException {
|
||||||
for (Ref ref : repo.getRefDatabase().getRefs(prefix).values())
|
for (Ref ref : repo.getRefDatabase().getRefsByPrefix(prefix))
|
||||||
addRef(ref, nonCommits, pending);
|
addRef(ref, nonCommits, pending);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -403,7 +403,7 @@ public boolean pack(ProgressMonitor pm) throws IOException {
|
||||||
}
|
}
|
||||||
|
|
||||||
private Collection<Ref> getAllRefs() throws IOException {
|
private Collection<Ref> getAllRefs() throws IOException {
|
||||||
Collection<Ref> refs = refdb.getRefs(RefDatabase.ALL).values();
|
Collection<Ref> refs = refdb.getRefsByPrefix(RefDatabase.ALL);
|
||||||
List<Ref> addl = refdb.getAdditionalRefs();
|
List<Ref> addl = refdb.getAdditionalRefs();
|
||||||
if (!addl.isEmpty()) {
|
if (!addl.isEmpty()) {
|
||||||
List<Ref> all = new ArrayList<>(refs.size() + addl.size());
|
List<Ref> all = new ArrayList<>(refs.size() + addl.size());
|
||||||
|
|
|
@ -785,7 +785,8 @@ private static boolean equals(Ref r1, Ref r2) {
|
||||||
* @throws java.io.IOException
|
* @throws java.io.IOException
|
||||||
*/
|
*/
|
||||||
public void packRefs() throws IOException {
|
public void packRefs() throws IOException {
|
||||||
Collection<Ref> refs = repo.getRefDatabase().getRefs(Constants.R_REFS).values();
|
Collection<Ref> refs = repo.getRefDatabase()
|
||||||
|
.getRefsByPrefix(Constants.R_REFS);
|
||||||
List<String> refsToBePacked = new ArrayList<>(refs.size());
|
List<String> refsToBePacked = new ArrayList<>(refs.size());
|
||||||
pm.beginTask(JGitText.get().packRefs, refs.size());
|
pm.beginTask(JGitText.get().packRefs, refs.size());
|
||||||
try {
|
try {
|
||||||
|
@ -1067,7 +1068,7 @@ private Set<ObjectId> listRefLogObjects(Ref ref, long minTime) throws IOExceptio
|
||||||
*/
|
*/
|
||||||
private Collection<Ref> getAllRefs() throws IOException {
|
private Collection<Ref> getAllRefs() throws IOException {
|
||||||
RefDatabase refdb = repo.getRefDatabase();
|
RefDatabase refdb = repo.getRefDatabase();
|
||||||
Collection<Ref> refs = refdb.getRefs(RefDatabase.ALL).values();
|
Collection<Ref> refs = refdb.getRefsByPrefix(RefDatabase.ALL);
|
||||||
List<Ref> addl = refdb.getAdditionalRefs();
|
List<Ref> addl = refdb.getAdditionalRefs();
|
||||||
if (!addl.isEmpty()) {
|
if (!addl.isEmpty()) {
|
||||||
List<Ref> all = new ArrayList<>(refs.size() + addl.size());
|
List<Ref> all = new ArrayList<>(refs.size() + addl.size());
|
||||||
|
@ -1375,7 +1376,7 @@ public RepoStatistics getStatistics() throws IOException {
|
||||||
}
|
}
|
||||||
|
|
||||||
RefDatabase refDb = repo.getRefDatabase();
|
RefDatabase refDb = repo.getRefDatabase();
|
||||||
for (Ref r : refDb.getRefs(RefDatabase.ALL).values()) {
|
for (Ref r : refDb.getRefsByPrefix(RefDatabase.ALL)) {
|
||||||
Storage storage = r.getStorage();
|
Storage storage = r.getStorage();
|
||||||
if (storage == Storage.LOOSE || storage == Storage.LOOSE_PACKED)
|
if (storage == Storage.LOOSE || storage == Storage.LOOSE_PACKED)
|
||||||
ret.numberOfLooseRefs++;
|
ret.numberOfLooseRefs++;
|
||||||
|
|
|
@ -282,7 +282,7 @@ private static ObjectId idOf(@Nullable Ref src) {
|
||||||
public List<Ref> getAdditionalRefs() throws IOException {
|
public List<Ref> getAdditionalRefs() throws IOException {
|
||||||
Collection<Ref> txnRefs;
|
Collection<Ref> txnRefs;
|
||||||
if (txnNamespace != null) {
|
if (txnNamespace != null) {
|
||||||
txnRefs = bootstrap.getRefs(txnNamespace).values();
|
txnRefs = bootstrap.getRefsByPrefix(txnNamespace);
|
||||||
} else {
|
} else {
|
||||||
Ref r = bootstrap.exactRef(txnCommitted);
|
Ref r = bootstrap.exactRef(txnCommitted);
|
||||||
if (r != null && r.getObjectId() != null) {
|
if (r != null && r.getObjectId() != null) {
|
||||||
|
|
|
@ -55,7 +55,6 @@
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import org.eclipse.jgit.errors.PackProtocolException;
|
import org.eclipse.jgit.errors.PackProtocolException;
|
||||||
|
@ -440,8 +439,7 @@ private int maxTimeWanted(final Collection<Ref> wants) {
|
||||||
|
|
||||||
private void markReachable(final Set<ObjectId> have, final int maxTime)
|
private void markReachable(final Set<ObjectId> have, final int maxTime)
|
||||||
throws IOException {
|
throws IOException {
|
||||||
Map<String, Ref> refs = local.getRefDatabase().getRefs(ALL);
|
for (Ref r : local.getRefDatabase().getRefsByPrefix(ALL)) {
|
||||||
for (final Ref r : refs.values()) {
|
|
||||||
ObjectId id = r.getPeeledObjectId();
|
ObjectId id = r.getPeeledObjectId();
|
||||||
if (id == null)
|
if (id == null)
|
||||||
id = r.getObjectId();
|
id = r.getObjectId();
|
||||||
|
|
|
@ -254,13 +254,14 @@ private void verifyPrerequisites() throws TransportException {
|
||||||
throw new MissingBundlePrerequisiteException(transport.uri,
|
throw new MissingBundlePrerequisiteException(transport.uri,
|
||||||
missing);
|
missing);
|
||||||
|
|
||||||
Map<String, Ref> localRefs;
|
List<Ref> localRefs;
|
||||||
try {
|
try {
|
||||||
localRefs = transport.local.getRefDatabase().getRefs(ALL);
|
localRefs = transport.local.getRefDatabase()
|
||||||
|
.getRefsByPrefix(ALL);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
throw new TransportException(transport.uri, e.getMessage(), e);
|
throw new TransportException(transport.uri, e.getMessage(), e);
|
||||||
}
|
}
|
||||||
for (final Ref r : localRefs.values()) {
|
for (final Ref r : localRefs) {
|
||||||
try {
|
try {
|
||||||
rw.markStart(rw.parseCommit(r.getObjectId()));
|
rw.markStart(rw.parseCommit(r.getObjectId()));
|
||||||
} catch (IOException readError) {
|
} catch (IOException readError) {
|
||||||
|
|
|
@ -689,12 +689,12 @@ public static Collection<RemoteRefUpdate> findRemoteRefUpdatesFor(
|
||||||
private static Collection<RefSpec> expandPushWildcardsFor(
|
private static Collection<RefSpec> expandPushWildcardsFor(
|
||||||
final Repository db, final Collection<RefSpec> specs)
|
final Repository db, final Collection<RefSpec> specs)
|
||||||
throws IOException {
|
throws IOException {
|
||||||
final Map<String, Ref> localRefs = db.getRefDatabase().getRefs(ALL);
|
final List<Ref> localRefs = db.getRefDatabase().getRefsByPrefix(ALL);
|
||||||
final Collection<RefSpec> procRefs = new LinkedHashSet<>();
|
final Collection<RefSpec> procRefs = new LinkedHashSet<>();
|
||||||
|
|
||||||
for (final RefSpec spec : specs) {
|
for (final RefSpec spec : specs) {
|
||||||
if (spec.isWildcard()) {
|
if (spec.isWildcard()) {
|
||||||
for (final Ref localRef : localRefs.values()) {
|
for (final Ref localRef : localRefs) {
|
||||||
if (spec.matchSource(localRef))
|
if (spec.matchSource(localRef))
|
||||||
procRefs.add(spec.expandFromSource(localRef));
|
procRefs.add(spec.expandFromSource(localRef));
|
||||||
}
|
}
|
||||||
|
|
|
@ -1582,7 +1582,8 @@ public void checkWants(UploadPack up, List<ObjectId> wants)
|
||||||
new ReachableCommitTipRequestValidator().checkWants(up, wants);
|
new ReachableCommitTipRequestValidator().checkWants(up, wants);
|
||||||
else if (!wants.isEmpty()) {
|
else if (!wants.isEmpty()) {
|
||||||
Set<ObjectId> refIds =
|
Set<ObjectId> refIds =
|
||||||
refIdSet(up.getRepository().getRefDatabase().getRefs(ALL).values());
|
refIdSet(up.getRepository().getRefDatabase()
|
||||||
|
.getRefsByPrefix(ALL));
|
||||||
for (ObjectId obj : wants) {
|
for (ObjectId obj : wants) {
|
||||||
if (!refIds.contains(obj))
|
if (!refIds.contains(obj))
|
||||||
throw new WantNotValidException(obj);
|
throw new WantNotValidException(obj);
|
||||||
|
@ -1602,7 +1603,8 @@ public static final class ReachableCommitTipRequestValidator
|
||||||
public void checkWants(UploadPack up, List<ObjectId> wants)
|
public void checkWants(UploadPack up, List<ObjectId> wants)
|
||||||
throws PackProtocolException, IOException {
|
throws PackProtocolException, IOException {
|
||||||
checkNotAdvertisedWants(up, wants,
|
checkNotAdvertisedWants(up, wants,
|
||||||
refIdSet(up.getRepository().getRefDatabase().getRefs(ALL).values()));
|
refIdSet(up.getRepository().getRefDatabase()
|
||||||
|
.getRefsByPrefix(ALL)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -58,7 +58,6 @@
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import org.eclipse.jgit.errors.CompoundException;
|
import org.eclipse.jgit.errors.CompoundException;
|
||||||
|
@ -690,13 +689,13 @@ private Collection<WalkRemoteObjectDatabase> expandOneAlternate(
|
||||||
}
|
}
|
||||||
|
|
||||||
private void markLocalRefsComplete(final Set<ObjectId> have) throws TransportException {
|
private void markLocalRefsComplete(final Set<ObjectId> have) throws TransportException {
|
||||||
Map<String, Ref> refs;
|
List<Ref> refs;
|
||||||
try {
|
try {
|
||||||
refs = local.getRefDatabase().getRefs(ALL);
|
refs = local.getRefDatabase().getRefsByPrefix(ALL);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
throw new TransportException(e.getMessage(), e);
|
throw new TransportException(e.getMessage(), e);
|
||||||
}
|
}
|
||||||
for (final Ref r : refs.values()) {
|
for (final Ref r : refs) {
|
||||||
try {
|
try {
|
||||||
markLocalObjComplete(revWalk.parseAny(r.getObjectId()));
|
markLocalObjComplete(revWalk.parseAny(r.getObjectId()));
|
||||||
} catch (IOException readError) {
|
} catch (IOException readError) {
|
||||||
|
|
Loading…
Reference in New Issue