Index: /trunk/src/org/openstreetmap/josm/data/osm/DataSetMerger.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/data/osm/DataSetMerger.java	(revision 9960)
+++ /trunk/src/org/openstreetmap/josm/data/osm/DataSetMerger.java	(revision 9961)
@@ -357,5 +357,5 @@
             // target is same as source but target is modified
             // => keep target and reset modified flag if target and source are semantically equal
-            if (target.hasEqualSemanticAttributes(source)) {
+            if (target.hasEqualSemanticAttributes(source, false)) {
                 target.setModified(false);
             }
Index: /trunk/src/org/openstreetmap/josm/data/osm/OsmPrimitive.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/data/osm/OsmPrimitive.java	(revision 9960)
+++ /trunk/src/org/openstreetmap/josm/data/osm/OsmPrimitive.java	(revision 9961)
@@ -1238,11 +1238,13 @@
      */
     public boolean hasEqualSemanticAttributes(OsmPrimitive other) {
+        return hasEqualSemanticAttributes(other, true);
+    }
+
+    boolean hasEqualSemanticAttributes(final OsmPrimitive other, final boolean testInterestingTagsOnly) {
         if (!isNew() &&  id != other.id)
             return false;
         if (isIncomplete() ^ other.isIncomplete()) // exclusive or operator for performance (see #7159)
             return false;
-        // can't do an equals check on the internal keys array because it is not ordered
-        //
-        return hasSameInterestingTags(other);
+        return testInterestingTagsOnly ? hasSameInterestingTags(other) : getKeys().equals(other.getKeys());
     }
 
Index: /trunk/test/unit/org/openstreetmap/josm/data/osm/DataSetMergerTest.java
===================================================================
--- /trunk/test/unit/org/openstreetmap/josm/data/osm/DataSetMergerTest.java	(revision 9960)
+++ /trunk/test/unit/org/openstreetmap/josm/data/osm/DataSetMergerTest.java	(revision 9961)
@@ -993,3 +993,44 @@
         assertEquals(2, w.getNode(1).getId());
     }
+
+    /**
+     * Non-regression test for <a href="https://josm.openstreetmap.de/ticket/12599">Bug #12599</a>.
+     */
+    @Test
+    public void testTicket12599() {
+        // Server node: no modifications
+        Node n1 = new Node(1, 1);
+        n1.setCoor(LatLon.ZERO);
+        assertFalse(n1.isModified());
+        their.addPrimitive(n1);
+
+        // Local node: one modification: addition of an uninteresting tag
+        Node n1b = new Node(n1);
+        n1b.setModified(true);
+        n1b.put("note", "something");
+        assertTrue(n1b.isModified());
+        assertEquals(0, n1b.getInterestingTags().size());
+        my.addPrimitive(n1b);
+
+        // Merge
+        DataSetMerger visitor = new DataSetMerger(my, their);
+        visitor.merge();
+
+        // Check that modification is still here
+        Node n = (Node) my.getPrimitiveById(1, OsmPrimitiveType.NODE);
+        assertNotNull(n);
+        assertEquals("something", n.get("note"));
+        assertTrue(n.isModified());
+
+        // Merge again
+        visitor = new DataSetMerger(my, their);
+        visitor.merge();
+
+        // Check that modification is still here
+        n = (Node) my.getPrimitiveById(1, OsmPrimitiveType.NODE);
+        assertNotNull(n);
+        assertEquals("something", n.get("note"));
+        assertTrue(n.isModified());
+    }
+
 }
