Merge "Don't auto follow non-annotated tags in fetch"

This commit is contained in:
Shawn O. Pearce 2011-03-13 19:22:31 -04:00 committed by Code Review
commit 2a137d8dea
1 changed files with 15 additions and 5 deletions

View File

@ -164,8 +164,10 @@ else if (tagopt == TagOpt.FETCH_TAGS)
have.addAll(askFor.keySet());
askFor.clear();
for (final Ref r : additionalTags) {
final ObjectId id = r.getPeeledObjectId();
if (id == null || transport.local.hasObject(id))
ObjectId id = r.getPeeledObjectId();
if (id == null)
id = r.getObjectId();
if (transport.local.hasObject(id))
wantTag(r);
}
@ -347,14 +349,22 @@ private Collection<Ref> expandAutoFollowTags() throws TransportException {
for (final Ref r : conn.getRefs()) {
if (!isTag(r))
continue;
Ref local = haveRefs.get(r.getName());
ObjectId obj = r.getObjectId();
if (r.getPeeledObjectId() == null) {
additionalTags.add(r);
if (local != null && obj.equals(local.getObjectId()))
continue;
if (askFor.containsKey(obj) || transport.local.hasObject(obj))
wantTag(r);
else
additionalTags.add(r);
continue;
}
final Ref local = haveRefs.get(r.getName());
if (local != null) {
if (!r.getObjectId().equals(local.getObjectId()))
if (!obj.equals(local.getObjectId()))
wantTag(r);
} else if (askFor.containsKey(r.getPeeledObjectId())
|| transport.local.hasObject(r.getPeeledObjectId()))