]> code.delx.au - offlineimap/commitdiff
Working to fix Syncable, but still issues
authorJohn Goerzen <jgoerzen@complete.org>
Thu, 29 May 2008 05:57:12 +0000 (00:57 -0500)
committerJohn Goerzen <jgoerzen@complete.org>
Thu, 29 May 2008 06:01:12 +0000 (01:01 -0500)
src/Data/Syncable.hs

index 62e2ee481c866af9b1b81edd07630d15665d537f..d872905ea21fcf987f583e47f5eb3e5508a1527e 100644 (file)
@@ -118,10 +118,19 @@ syncBiDir masterstate childstate lastchildstate =
                           findAdded masterstate childstate $ lastchildstate)
                          ++ (map (pairToFunc ModifyContent) . Map.toList $ childPayloadChanges)
           masterPayloadChanges = 
-              Map.intersection
-                 (Map.union (findModified childstate lastchildstate)
-                  (findModified childstate masterstate))
-                 masterstate
+                 (Map.filterWithKey filterKV
+                     (Map.intersection 
+                         (Map.union (findModified childstate lastchildstate)
+                                    (findModified childstate masterstate)
+                         )
+                         masterstate
+                     )
+                 )
+              where filterKV k v = -- Eliminate changes that would set the value to what it already is
+                        case Map.lookup k masterstate of
+                          (Just m) -> m /= v 
+                          Nothing -> False
+                 
           -- The child's payload takes precedence, so we are going to
           -- calculate the changes made on the master to apply to the client,
           -- then subtract out any items in the master changes that have the