Browse Source

UploadPack: Include peeled ObjectId as advertised

A RefAdvertiser writing to the network includes both the reference's
ObjectId and its peeled ObjectId in the advertised set.  In smart HTTP
negotiation requests may bypass the RefAdvertiser and quickly build
the set based on current refs; include the peeled ObjectIds to match
behavior with the normal bidirectional protocols on git:// and SSH.

Change-Id: I5371bed60da36e8d12c4ad9a5c1d91a0f0ad486b
stable-4.5
Shawn Pearce 8 years ago
parent
commit
5196798cb7
  1. 10
      org.eclipse.jgit/src/org/eclipse/jgit/transport/UploadPack.java

10
org.eclipse.jgit/src/org/eclipse/jgit/transport/UploadPack.java

@ -777,8 +777,14 @@ public class UploadPack {
private static Set<ObjectId> refIdSet(Collection<Ref> refs) { private static Set<ObjectId> refIdSet(Collection<Ref> refs) {
Set<ObjectId> ids = new HashSet<ObjectId>(refs.size()); Set<ObjectId> ids = new HashSet<ObjectId>(refs.size());
for (Ref ref : refs) { for (Ref ref : refs) {
if (ref.getObjectId() != null) ObjectId id = ref.getObjectId();
ids.add(ref.getObjectId()); if (id != null) {
ids.add(id);
}
id = ref.getPeeledObjectId();
if (id != null) {
ids.add(id);
}
} }
return ids; return ids;
} }

Loading…
Cancel
Save