fix call to warnExportImportConflict
authorJoey Hess <joeyh@joeyh.name>
Thu, 17 Dec 2020 20:25:02 +0000 (16:25 -0400)
committerJoey Hess <joeyh@joeyh.name>
Thu, 17 Dec 2020 20:25:02 +0000 (16:25 -0400)
That needs a Remote that has the right export/import set up, not the input
Remote, which does not yet.

Remote/Helper/ExportImport.hs

index 412f2970669980b6573af9949ab80ec94b2d75f3..9ff6f92800c75162460b295c2d4286e23522ffa5 100644 (file)
@@ -104,11 +104,7 @@ adjustExportImport :: Remote -> RemoteStateHandle -> Annex Remote
 adjustExportImport r rs = do
        isexport <- pure (exportTree (config r)) <&&> isExportSupported r
        isimport <- pure (importTree (config r)) <&&> isImportSupported r
-       let normal = not isexport && not isimport
-       let iskeyvaluestore = normal || appendonly r
-       dbv <- prepdbv
-       ciddbv <- prepciddb
-       return $ r
+       let r' = r
                { remotetype = (remotetype r)
                        { exportSupported = if isexport
                                then exportSupported (remotetype r)
@@ -117,7 +113,19 @@ adjustExportImport r rs = do
                                then importSupported (remotetype r)
                                else importUnsupported
                        }
-               , exportActions = if isexport
+               }
+       if not isexport && not isimport
+               then return r'
+               else adjustExportImport' isexport isimport r' rs
+
+adjustExportImport' :: Bool -> Bool -> Remote -> RemoteStateHandle -> Annex Remote
+adjustExportImport' isexport isimport r rs = do
+       dbv <- prepdbv
+       ciddbv <- prepciddb
+       let normal = not isexport && not isimport
+       let iskeyvaluestore = normal || appendonly r
+       return $ r
+               { exportActions = if isexport
                        then if isimport
                                then exportActionsForImport dbv ciddbv (exportActions r)
                                else exportActions r