Index: trunk/src/org/openstreetmap/josm/data/osm/visitor/MergeVisitor.java
===================================================================
--- trunk/src/org/openstreetmap/josm/data/osm/visitor/MergeVisitor.java	(revision 480)
+++ trunk/src/org/openstreetmap/josm/data/osm/visitor/MergeVisitor.java	(revision 481)
@@ -63,9 +63,7 @@
 		// 2. Try to find a prim we can merge with the prim from the other ds.
 		for (P my : myprims) {
-			if (!mergeprims.contains(my)) { // This checks for id equality.
-				continue;
-			}
-
-			if (match(my, other)) {
+			// LinkedList.contains calls equal, and OsmPrimitive.equal
+			// compares just the id.
+			if (match(my, other) && !mergeprims.contains(my)) {
 				merged.put(other, my);
 				mergeCommon(my, other);
