diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/BasePackFetchConnection.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/BasePackFetchConnection.java index 7d8590a77..4ae26a3e5 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/BasePackFetchConnection.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/BasePackFetchConnection.java @@ -317,24 +317,19 @@ private int maxTimeWanted(final Collection wants) { private void markReachable(final Set have, final int maxTime) throws IOException { for (final Ref r : local.getAllRefs().values()) { - try { - final RevCommit o = walk.parseCommit(r.getObjectId()); - o.add(REACHABLE); - reachableCommits.add(o); - } catch (IOException readError) { - // If we cannot read the value of the ref skip it. - } + ObjectId id = r.getPeeledObjectId(); + if (id == null) + id = r.getObjectId(); + if (id == null) + continue; + parseReachable(id); } - for (final ObjectId id : have) { - try { - final RevCommit o = walk.parseCommit(id); - o.add(REACHABLE); - reachableCommits.add(o); - } catch (IOException readError) { - // If we cannot read the value of the ref skip it. - } - } + for (ObjectId id : local.getAdditionalHaves()) + parseReachable(id); + + for (ObjectId id : have) + parseReachable(id); if (maxTime > 0) { // Mark reachable commits until we reach maxTime. These may @@ -361,6 +356,18 @@ private void markReachable(final Set have, final int maxTime) } } + private void parseReachable(ObjectId id) { + try { + RevCommit o = walk.parseCommit(id); + if (!o.has(REACHABLE)) { + o.add(REACHABLE); + reachableCommits.add(o); + } + } catch (IOException readError) { + // If we cannot read the value of the ref skip it. + } + } + private boolean sendWants(final Collection want) throws IOException { final PacketLineOut p = statelessRPC ? pckState : pckOut; boolean first = true;