Fix: Tags are not replicated properly

Tags were not replicated when authGroup option
was used in replication.config.

Since VisibleRefFilter.filter() only checks
if tags are reachable against the other refs in the
incoming ref-map, single tag pushes or valid tags
on other refs could not be replicated.

Bug: issue 807
Change-Id: I764e16dec92ff81a41ce2170d5dbc114324ec882
This commit is contained in:
Gustaf Lundh
2011-11-07 18:38:21 +01:00
parent ac7d2f3448
commit 882806e1b2
2 changed files with 8 additions and 3 deletions

View File

@@ -314,7 +314,7 @@ class PushOp implements ProjectRunnable {
return Collections.emptyList();
}
try {
local = new VisibleRefFilter(tagCache, db, pc, meta, true).filter(local);
local = new VisibleRefFilter(tagCache, db, pc, meta, true).filter(local, true);
} finally {
meta.close();
}

View File

@@ -60,6 +60,10 @@ public class VisibleRefFilter implements RefFilter {
@Override
public Map<String, Ref> filter(Map<String, Ref> refs) {
return filter(refs, false);
}
public Map<String, Ref> filter(Map<String, Ref> refs, boolean filterTagsSeperately) {
final Set<Change.Id> visibleChanges = visibleChanges();
final Map<String, Ref> result = new HashMap<String, Ref>();
final List<Ref> deferredTags = new ArrayList<Ref>();
@@ -91,8 +95,9 @@ public class VisibleRefFilter implements RefFilter {
// If we have tags that were deferred, we need to do a revision walk
// to identify what tags we can actually reach, and what we cannot.
//
if (!deferredTags.isEmpty() && !result.isEmpty()) {
TagMatcher tags = tagCache.get(projectName).matcher(db, result.values());
if (!deferredTags.isEmpty() && (!result.isEmpty() || filterTagsSeperately)) {
TagMatcher tags = tagCache.get(projectName).
matcher(db, filterTagsSeperately ? filter(db.getAllRefs()).values() : result.values());
for (Ref tag : deferredTags) {
if (tags.isReachable(tag)) {
result.put(tag.getName(), tag);