]> code.delx.au - offlineimap/blobdiff - src/Data/Syncable.hs
Much progress on syncable; important tests are passing!
[offlineimap] / src / Data / Syncable.hs
index 5143630539aaf62a7ad4688d6e8c6f5adec1d4ab..f583466c7bc372e54e919f8c7a69f3e1cbb18f2d 100644 (file)
@@ -129,8 +129,8 @@ syncBiDir masterstate childstate lastchildstate =
           -- then subtract out any items in the master changes that have the
           -- same key.
           childPayloadChanges = 
-              Map.union (findModified childstate childstate masterstate lastchildstate)
-                 (findModified childstate childstate childstate lastchildstate)
+              Map.difference (findModified childstate masterstate masterstate lastchildstate)
+                 (findModified masterstate childstate childstate lastchildstate)
 
 {- | Compares two SyncCollections, and returns the commands that, when
 applied to the first collection, would yield the second. -}
@@ -187,7 +187,7 @@ findModified basestate authoritativestate comparisonstate laststate =
                         (Just basev, Just authv) ->
                             if (authv /= lastv) && (authv /= basev)
                                then Just authv
-                               else if compv /= basev
+                               else if compv /= basev && (authv /= basev)
                                     then Just compv
                                     else Nothing