From a56d3c92b9672c6d84ac007a404b07d3eeb51025 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Thu, 8 Oct 2015 17:58:32 -0400 Subject: support invalidating existing VerifiedCopys --- Command/Drop.hs | 5 +++-- Command/Import.hs | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) (limited to 'Command') diff --git a/Command/Drop.hs b/Command/Drop.hs index 49e4bea85..26872c6c0 100644 --- a/Command/Drop.hs +++ b/Command/Drop.hs @@ -95,7 +95,7 @@ startRemote afile numcopies key remote = do performLocal :: Key -> AssociatedFile -> NumCopies -> [VerifiedCopy] -> CommandPerform performLocal key afile numcopies preverified = lockContentExclusive key $ \contentlock -> do (remotes, trusteduuids) <- Remote.keyPossibilitiesTrusted key - let preverified' = preverified ++ map TrustedCopy trusteduuids + let preverified' = preverified ++ map (mkVerifiedCopy TrustedCopy) trusteduuids untrusteduuids <- trustGet UnTrusted let tocheck = Remote.remotesWithoutUUID remotes (map toUUID preverified'++untrusteduuids) u <- getUUID @@ -117,10 +117,11 @@ performRemote key afile numcopies remote = do -- as long as the local repo is not untrusted. (remotes, trusteduuids) <- knownCopies key let trusted = filter (/= uuid) trusteduuids + let preverified = map (mkVerifiedCopy TrustedCopy) trusted untrusteduuids <- trustGet UnTrusted let tocheck = filter (/= remote) $ Remote.remotesWithoutUUID remotes (trusted++untrusteduuids) - stopUnless (canDrop uuid key afile numcopies [uuid] (map TrustedCopy trusted) tocheck) $ do + stopUnless (canDrop uuid key afile numcopies [uuid] preverified tocheck) $ do ok <- Remote.removeKey remote key next $ cleanupRemote key remote ok where diff --git a/Command/Import.hs b/Command/Import.hs index fbce4c55a..3206ad48b 100644 --- a/Command/Import.hs +++ b/Command/Import.hs @@ -143,4 +143,4 @@ verifiedExisting key destfile = do (remotes, trusteduuids) <- knownCopies key untrusteduuids <- trustGet UnTrusted let tocheck = Remote.remotesWithoutUUID remotes (trusteduuids++untrusteduuids) - verifyEnoughCopies [] key need [] (map TrustedCopy trusteduuids) tocheck + verifyEnoughCopies [] key need [] (map (mkVerifiedCopy TrustedCopy) trusteduuids) tocheck -- cgit v1.2.3