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
This commit is contained in:
Shawn Pearce 2016-07-04 17:23:47 -07:00
parent c4ee45c692
commit 5196798cb7
1 changed files with 8 additions and 2 deletions

View File

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