Propagate IOException where possible when getting refs.
Currently, Repository.getAllRefs() and Repository.getTags() silently ignores an IOException and instead returns an empty map. Repository is a public API and as such cannot be changed until the next major revision change. Where possible, update the internal jgit APIs to use the RefDatabase directly, since it propagates the error. Change-Id: I4e4537d8bd0fa772f388262684c5c4ca1929dc4c
This commit is contained in:
parent
7995d87713
commit
5218f7b33a
|
@ -44,6 +44,7 @@
|
||||||
package org.eclipse.jgit.http.server;
|
package org.eclipse.jgit.http.server;
|
||||||
|
|
||||||
import static org.eclipse.jgit.http.server.ServletUtils.getRepository;
|
import static org.eclipse.jgit.http.server.ServletUtils.getRepository;
|
||||||
|
import static org.eclipse.jgit.lib.RefDatabase.ALL;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.OutputStreamWriter;
|
import java.io.OutputStreamWriter;
|
||||||
|
@ -91,7 +92,7 @@ protected void end() {
|
||||||
adv.init(db);
|
adv.init(db);
|
||||||
adv.setDerefTags(true);
|
adv.setDerefTags(true);
|
||||||
|
|
||||||
Map<String, Ref> refs = db.getAllRefs();
|
Map<String, Ref> refs = db.getRefDatabase().getRefs(ALL);
|
||||||
refs.remove(Constants.HEAD);
|
refs.remove(Constants.HEAD);
|
||||||
adv.send(refs);
|
adv.send(refs);
|
||||||
out.close();
|
out.close();
|
||||||
|
|
|
@ -43,6 +43,8 @@
|
||||||
|
|
||||||
package org.eclipse.jgit.pgm;
|
package org.eclipse.jgit.pgm;
|
||||||
|
|
||||||
|
import static org.eclipse.jgit.lib.RefDatabase.ALL;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.text.MessageFormat;
|
import java.text.MessageFormat;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
@ -175,7 +177,7 @@ protected void run() throws Exception {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void list() throws Exception {
|
private void list() throws Exception {
|
||||||
Map<String, Ref> refs = db.getAllRefs();
|
Map<String, Ref> refs = db.getRefDatabase().getRefs(ALL);
|
||||||
Ref head = refs.get(Constants.HEAD);
|
Ref head = refs.get(Constants.HEAD);
|
||||||
// This can happen if HEAD is stillborn
|
// This can happen if HEAD is stillborn
|
||||||
if (head != null) {
|
if (head != null) {
|
||||||
|
|
|
@ -44,6 +44,8 @@
|
||||||
|
|
||||||
package org.eclipse.jgit.pgm;
|
package org.eclipse.jgit.pgm;
|
||||||
|
|
||||||
|
import static org.eclipse.jgit.lib.RefDatabase.ALL;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
@ -64,7 +66,7 @@ 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.getAllRefs();
|
Map<String, Ref> allRefs = db.getRefDatabase().getRefs(ALL);
|
||||||
for (final Ref r : allRefs.values())
|
for (final Ref r : allRefs.values())
|
||||||
outw.println(r.getObjectId().name());
|
outw.println(r.getObjectId().name());
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -47,6 +47,7 @@
|
||||||
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.kohsuke.args4j.Argument;
|
import org.kohsuke.args4j.Argument;
|
||||||
import org.kohsuke.args4j.Option;
|
import org.kohsuke.args4j.Option;
|
||||||
|
@ -55,6 +56,7 @@
|
||||||
import org.eclipse.jgit.lib.Constants;
|
import org.eclipse.jgit.lib.Constants;
|
||||||
import org.eclipse.jgit.lib.ObjectId;
|
import org.eclipse.jgit.lib.ObjectId;
|
||||||
import org.eclipse.jgit.lib.Ref;
|
import org.eclipse.jgit.lib.Ref;
|
||||||
|
import org.eclipse.jgit.lib.RefDatabase;
|
||||||
import org.eclipse.jgit.pgm.internal.CLIText;
|
import org.eclipse.jgit.pgm.internal.CLIText;
|
||||||
import org.eclipse.jgit.pgm.opt.PathTreeFilterHandler;
|
import org.eclipse.jgit.pgm.opt.PathTreeFilterHandler;
|
||||||
import org.eclipse.jgit.revwalk.FollowFilter;
|
import org.eclipse.jgit.revwalk.FollowFilter;
|
||||||
|
@ -164,8 +166,10 @@ protected void run() throws Exception {
|
||||||
else if (revLimiter.size() > 1)
|
else if (revLimiter.size() > 1)
|
||||||
walk.setRevFilter(AndRevFilter.create(revLimiter));
|
walk.setRevFilter(AndRevFilter.create(revLimiter));
|
||||||
|
|
||||||
if (all)
|
if (all) {
|
||||||
for (Ref a : db.getAllRefs().values()) {
|
Map<String, Ref> refs =
|
||||||
|
db.getRefDatabase().getRefs(RefDatabase.ALL);
|
||||||
|
for (Ref a : refs.values()) {
|
||||||
ObjectId oid = a.getPeeledObjectId();
|
ObjectId oid = a.getPeeledObjectId();
|
||||||
if (oid == null)
|
if (oid == null)
|
||||||
oid = a.getObjectId();
|
oid = a.getObjectId();
|
||||||
|
@ -175,6 +179,7 @@ else if (revLimiter.size() > 1)
|
||||||
// Ignore all refs which are not commits
|
// Ignore all refs which are not commits
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (commits.isEmpty()) {
|
if (commits.isEmpty()) {
|
||||||
final ObjectId head = db.resolve(Constants.HEAD);
|
final ObjectId head = db.resolve(Constants.HEAD);
|
||||||
|
|
|
@ -45,6 +45,8 @@
|
||||||
|
|
||||||
package org.eclipse.jgit.pgm;
|
package org.eclipse.jgit.pgm;
|
||||||
|
|
||||||
|
import static org.eclipse.jgit.lib.RefDatabase.ALL;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.SortedMap;
|
import java.util.SortedMap;
|
||||||
|
@ -65,8 +67,8 @@ protected void run() throws Exception {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private Iterable<Ref> getSortedRefs() {
|
private Iterable<Ref> getSortedRefs() throws Exception {
|
||||||
Map<String, Ref> all = db.getAllRefs();
|
Map<String, Ref> all = db.getRefDatabase().getRefs(ALL);
|
||||||
if (all instanceof RefMap
|
if (all instanceof RefMap
|
||||||
|| (all instanceof SortedMap && ((SortedMap) all).comparator() == null))
|
|| (all instanceof SortedMap && ((SortedMap) all).comparator() == null))
|
||||||
return all.values();
|
return all.values();
|
||||||
|
|
|
@ -43,6 +43,8 @@
|
||||||
|
|
||||||
package org.eclipse.jgit.pgm.debug;
|
package org.eclipse.jgit.pgm.debug;
|
||||||
|
|
||||||
|
import static org.eclipse.jgit.lib.RefDatabase.ALL;
|
||||||
|
|
||||||
import java.io.BufferedReader;
|
import java.io.BufferedReader;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileInputStream;
|
import java.io.FileInputStream;
|
||||||
|
@ -114,7 +116,7 @@ class RebuildCommitGraph extends TextBuiltin {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void run() throws Exception {
|
protected void run() throws Exception {
|
||||||
if (!really && !db.getAllRefs().isEmpty()) {
|
if (!really && !db.getRefDatabase().getRefs(ALL).isEmpty()) {
|
||||||
System.err.println(
|
System.err.println(
|
||||||
MessageFormat.format(CLIText.get().fatalThisProgramWillDestroyTheRepository
|
MessageFormat.format(CLIText.get().fatalThisProgramWillDestroyTheRepository
|
||||||
, db.getDirectory().getAbsolutePath(), REALLY));
|
, db.getDirectory().getAbsolutePath(), REALLY));
|
||||||
|
@ -241,7 +243,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);
|
||||||
for (final Ref r : db.getAllRefs().values()) {
|
Map<String, Ref> refs = db.getRefDatabase().getRefs(ALL);
|
||||||
|
for (final Ref r : refs.values()) {
|
||||||
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());
|
||||||
|
|
|
@ -152,7 +152,8 @@ public String call() throws GitAPIException {
|
||||||
throw new IllegalArgumentException(JGitText.get().targetIsNotSet);
|
throw new IllegalArgumentException(JGitText.get().targetIsNotSet);
|
||||||
|
|
||||||
Map<ObjectId, Ref> tags = new HashMap<ObjectId, Ref>();
|
Map<ObjectId, Ref> tags = new HashMap<ObjectId, Ref>();
|
||||||
for (Ref r : repo.getTags().values()) {
|
|
||||||
|
for (Ref r : repo.getRefDatabase().getRefs(R_TAGS).values()) {
|
||||||
ObjectId key = repo.peel(r).getPeeledObjectId();
|
ObjectId key = repo.peel(r).getPeeledObjectId();
|
||||||
if (key == null)
|
if (key == null)
|
||||||
key = r.getObjectId();
|
key = r.getObjectId();
|
||||||
|
|
|
@ -42,10 +42,13 @@
|
||||||
*/
|
*/
|
||||||
package org.eclipse.jgit.api;
|
package org.eclipse.jgit.api;
|
||||||
|
|
||||||
|
import static org.eclipse.jgit.lib.RefDatabase.ALL;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
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;
|
||||||
|
@ -252,7 +255,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 {
|
||||||
for (Ref ref : getRepository().getAllRefs().values()) {
|
Map<String, Ref> refs = getRepository().getRefDatabase().getRefs(ALL);
|
||||||
|
for (Ref ref : refs.values()) {
|
||||||
if(!ref.isPeeled())
|
if(!ref.isPeeled())
|
||||||
ref = getRepository().peel(ref);
|
ref = getRepository().peel(ref);
|
||||||
|
|
||||||
|
|
|
@ -48,6 +48,7 @@
|
||||||
import static org.eclipse.jgit.internal.storage.pack.PackExt.BITMAP_INDEX;
|
import static org.eclipse.jgit.internal.storage.pack.PackExt.BITMAP_INDEX;
|
||||||
import static org.eclipse.jgit.internal.storage.pack.PackExt.INDEX;
|
import static org.eclipse.jgit.internal.storage.pack.PackExt.INDEX;
|
||||||
import static org.eclipse.jgit.internal.storage.pack.PackExt.PACK;
|
import static org.eclipse.jgit.internal.storage.pack.PackExt.PACK;
|
||||||
|
import static org.eclipse.jgit.lib.RefDatabase.ALL;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
@ -194,7 +195,7 @@ public boolean pack(ProgressMonitor pm) throws IOException {
|
||||||
refdb.clearCache();
|
refdb.clearCache();
|
||||||
objdb.clearCache();
|
objdb.clearCache();
|
||||||
|
|
||||||
refsBefore = repo.getAllRefs();
|
refsBefore = refdb.getRefs(ALL);
|
||||||
packsBefore = packsToRebuild();
|
packsBefore = packsToRebuild();
|
||||||
if (packsBefore.isEmpty())
|
if (packsBefore.isEmpty())
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -46,6 +46,8 @@
|
||||||
|
|
||||||
package org.eclipse.jgit.internal.storage.file;
|
package org.eclipse.jgit.internal.storage.file;
|
||||||
|
|
||||||
|
import static org.eclipse.jgit.lib.RefDatabase.ALL;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.text.MessageFormat;
|
import java.text.MessageFormat;
|
||||||
|
@ -382,7 +384,7 @@ public void openPack(final File pack) throws IOException {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void scanForRepoChanges() throws IOException {
|
public void scanForRepoChanges() throws IOException {
|
||||||
getAllRefs(); // This will look for changes to refs
|
getRefDatabase().getRefs(ALL); // This will look for changes to refs
|
||||||
detectIndexChanges();
|
detectIndexChanges();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -45,6 +45,7 @@
|
||||||
|
|
||||||
import static org.eclipse.jgit.internal.storage.pack.PackExt.BITMAP_INDEX;
|
import static org.eclipse.jgit.internal.storage.pack.PackExt.BITMAP_INDEX;
|
||||||
import static org.eclipse.jgit.internal.storage.pack.PackExt.INDEX;
|
import static org.eclipse.jgit.internal.storage.pack.PackExt.INDEX;
|
||||||
|
import static org.eclipse.jgit.lib.RefDatabase.ALL;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileOutputStream;
|
import java.io.FileOutputStream;
|
||||||
|
@ -457,7 +458,7 @@ private static boolean equals(Ref r1, Ref r2) {
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
*/
|
*/
|
||||||
public void packRefs() throws IOException {
|
public void packRefs() throws IOException {
|
||||||
Collection<Ref> refs = repo.getAllRefs().values();
|
Collection<Ref> refs = repo.getRefDatabase().getRefs(ALL).values();
|
||||||
List<String> refsToBePacked = new ArrayList<String>(refs.size());
|
List<String> refsToBePacked = new ArrayList<String>(refs.size());
|
||||||
pm.beginTask(JGitText.get().packRefs, refs.size());
|
pm.beginTask(JGitText.get().packRefs, refs.size());
|
||||||
try {
|
try {
|
||||||
|
@ -574,7 +575,7 @@ private Set<ObjectId> listRefLogObjects(Ref ref, long minTime) throws IOExceptio
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
*/
|
*/
|
||||||
private Map<String, Ref> getAllRefs() throws IOException {
|
private Map<String, Ref> getAllRefs() throws IOException {
|
||||||
Map<String, Ref> ret = repo.getAllRefs();
|
Map<String, Ref> ret = repo.getRefDatabase().getRefs(ALL);
|
||||||
for (Ref ref : repo.getRefDatabase().getAdditionalRefs())
|
for (Ref ref : repo.getRefDatabase().getAdditionalRefs())
|
||||||
ret.put(ref.getName(), ref);
|
ret.put(ref.getName(), ref);
|
||||||
return ret;
|
return ret;
|
||||||
|
|
|
@ -45,6 +45,8 @@
|
||||||
|
|
||||||
package org.eclipse.jgit.transport;
|
package org.eclipse.jgit.transport;
|
||||||
|
|
||||||
|
import static org.eclipse.jgit.lib.RefDatabase.ALL;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
|
@ -52,6 +54,7 @@
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import org.eclipse.jgit.errors.PackProtocolException;
|
import org.eclipse.jgit.errors.PackProtocolException;
|
||||||
|
@ -400,7 +403,8 @@ 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 {
|
||||||
for (final Ref r : local.getAllRefs().values()) {
|
Map<String, Ref> refs = local.getRefDatabase().getRefs(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();
|
||||||
|
|
|
@ -47,6 +47,8 @@
|
||||||
|
|
||||||
package org.eclipse.jgit.transport;
|
package org.eclipse.jgit.transport;
|
||||||
|
|
||||||
|
import static org.eclipse.jgit.lib.RefDatabase.ALL;
|
||||||
|
|
||||||
import java.io.BufferedInputStream;
|
import java.io.BufferedInputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
|
@ -242,7 +244,13 @@ private void verifyPrerequisites() throws TransportException {
|
||||||
throw new MissingBundlePrerequisiteException(transport.uri,
|
throw new MissingBundlePrerequisiteException(transport.uri,
|
||||||
missing);
|
missing);
|
||||||
|
|
||||||
for (final Ref r : transport.local.getAllRefs().values()) {
|
Map<String, Ref> localRefs;
|
||||||
|
try {
|
||||||
|
localRefs = transport.local.getRefDatabase().getRefs(ALL);
|
||||||
|
} catch (IOException e) {
|
||||||
|
throw new TransportException(transport.uri, e.getMessage(), e);
|
||||||
|
}
|
||||||
|
for (final Ref r : localRefs.values()) {
|
||||||
try {
|
try {
|
||||||
rw.markStart(rw.parseCommit(r.getObjectId()));
|
rw.markStart(rw.parseCommit(r.getObjectId()));
|
||||||
} catch (IOException readError) {
|
} catch (IOException readError) {
|
||||||
|
|
|
@ -46,6 +46,8 @@
|
||||||
|
|
||||||
package org.eclipse.jgit.transport;
|
package org.eclipse.jgit.transport;
|
||||||
|
|
||||||
|
import static org.eclipse.jgit.lib.RefDatabase.ALL;
|
||||||
|
|
||||||
import java.io.BufferedReader;
|
import java.io.BufferedReader;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
|
@ -644,8 +646,9 @@ 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)
|
||||||
final Map<String, Ref> localRefs = db.getAllRefs();
|
throws IOException {
|
||||||
|
final Map<String, Ref> localRefs = db.getRefDatabase().getRefs(ALL);
|
||||||
final Collection<RefSpec> procRefs = new HashSet<RefSpec>();
|
final Collection<RefSpec> procRefs = new HashSet<RefSpec>();
|
||||||
|
|
||||||
for (final RefSpec spec : specs) {
|
for (final RefSpec spec : specs) {
|
||||||
|
|
|
@ -43,6 +43,8 @@
|
||||||
|
|
||||||
package org.eclipse.jgit.transport;
|
package org.eclipse.jgit.transport;
|
||||||
|
|
||||||
|
import static org.eclipse.jgit.lib.RefDatabase.ALL;
|
||||||
|
|
||||||
import java.io.EOFException;
|
import java.io.EOFException;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
|
@ -1129,7 +1131,7 @@ 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().getAllRefs().values());
|
refIdSet(up.getRepository().getRefDatabase().getRefs(ALL).values());
|
||||||
for (ObjectId obj : wants) {
|
for (ObjectId obj : wants) {
|
||||||
if (!refIds.contains(obj))
|
if (!refIds.contains(obj))
|
||||||
throw new PackProtocolException(MessageFormat.format(
|
throw new PackProtocolException(MessageFormat.format(
|
||||||
|
@ -1149,7 +1151,7 @@ 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.getRevWalk(), wants,
|
checkNotAdvertisedWants(up.getRevWalk(), wants,
|
||||||
refIdSet(up.getRepository().getAllRefs().values()));
|
refIdSet(up.getRepository().getRefDatabase().getRefs(ALL).values()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -44,6 +44,8 @@
|
||||||
|
|
||||||
package org.eclipse.jgit.transport;
|
package org.eclipse.jgit.transport;
|
||||||
|
|
||||||
|
import static org.eclipse.jgit.lib.RefDatabase.ALL;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileNotFoundException;
|
import java.io.FileNotFoundException;
|
||||||
import java.io.FileOutputStream;
|
import java.io.FileOutputStream;
|
||||||
|
@ -56,6 +58,7 @@
|
||||||
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;
|
||||||
|
@ -668,7 +671,13 @@ private Collection<WalkRemoteObjectDatabase> expandOneAlternate(
|
||||||
}
|
}
|
||||||
|
|
||||||
private void markLocalRefsComplete(final Set<ObjectId> have) throws TransportException {
|
private void markLocalRefsComplete(final Set<ObjectId> have) throws TransportException {
|
||||||
for (final Ref r : local.getAllRefs().values()) {
|
Map<String, Ref> refs;
|
||||||
|
try {
|
||||||
|
refs = local.getRefDatabase().getRefs(ALL);
|
||||||
|
} catch (IOException e) {
|
||||||
|
throw new TransportException(e.getMessage(), e);
|
||||||
|
}
|
||||||
|
for (final Ref r : refs.values()) {
|
||||||
try {
|
try {
|
||||||
markLocalObjComplete(revWalk.parseAny(r.getObjectId()));
|
markLocalObjComplete(revWalk.parseAny(r.getObjectId()));
|
||||||
} catch (IOException readError) {
|
} catch (IOException readError) {
|
||||||
|
|
Loading…
Reference in New Issue