diff options
author | Joey Hess <joeyh@joeyh.name> | 2015-10-01 13:28:49 -0400 |
---|---|---|
committer | Joey Hess <joeyh@joeyh.name> | 2015-10-01 13:29:17 -0400 |
commit | e3969aeb3c1d8a91a31d4da31097ab5c59436774 (patch) | |
tree | 7fd39a284fa2d7ed37a3aab5edbbe5f80cce76d0 /Command | |
parent | 5be958bddc3afeabe51bd9da598682617ba4e0e7 (diff) |
rename fsckKey to verifyKeyContent
No behavior changes.
Diffstat (limited to 'Command')
-rw-r--r-- | Command/Fsck.hs | 9 | ||||
-rw-r--r-- | Command/RecvKey.hs | 6 | ||||
-rw-r--r-- | Command/TestRemote.hs | 6 |
3 files changed, 12 insertions, 9 deletions
diff --git a/Command/Fsck.hs b/Command/Fsck.hs index 656ceb644..f34b9b074 100644 --- a/Command/Fsck.hs +++ b/Command/Fsck.hs @@ -349,12 +349,15 @@ checkBackendOr :: (Key -> Annex String) -> Backend -> Key -> FilePath -> Annex B checkBackendOr bad backend key file = checkBackendOr' bad backend key file (return True) +-- The postcheck action is run after the content is verified, +-- in order to detect situations where the file is changed while being +-- verified (particularly in direct mode). checkBackendOr' :: (Key -> Annex String) -> Backend -> Key -> FilePath -> Annex Bool -> Annex Bool checkBackendOr' bad backend key file postcheck = - case Types.Backend.fsckKey backend of + case Types.Backend.verifyKeyContent backend of Nothing -> return True - Just a -> do - ok <- a key file + Just verifier -> do + ok <- verifier key file ifM postcheck ( do unless ok $ do diff --git a/Command/RecvKey.hs b/Command/RecvKey.hs index cb24dbb47..7477bb879 100644 --- a/Command/RecvKey.hs +++ b/Command/RecvKey.hs @@ -70,13 +70,13 @@ start key = fieldTransfer Download key $ \_p -> Nothing -> do warning "recvkey: received key from direct mode repository using unknown backend; cannot check; discarding" return False - Just backend -> maybe (return True) runfsck - (Types.Backend.fsckKey backend) + Just backend -> maybe (return True) runverify + (Types.Backend.verifyKeyContent backend) else do warning "recvkey: received key with wrong size; discarding" return False where - runfsck check = ifM (check key tmp) + runverify check = ifM (check key tmp) ( return True , do warning "recvkey: received key from direct mode repository seems to have changed as it was transferred; discarding" diff --git a/Command/TestRemote.hs b/Command/TestRemote.hs index e51dcaeb3..fbe83f2db 100644 --- a/Command/TestRemote.hs +++ b/Command/TestRemote.hs @@ -14,7 +14,7 @@ import qualified Remote import qualified Types.Remote as Remote import Types import Types.Key (key2file, keyBackendName, keySize) -import Types.Backend (getKey, fsckKey) +import Types.Backend (getKey, verifyKeyContent) import Types.KeySource import Annex.Content import Backend @@ -156,9 +156,9 @@ test st r k = (== Right b) <$> Remote.hasKey r k fsck = case maybeLookupBackendName (keyBackendName k) of Nothing -> return True - Just b -> case fsckKey b of + Just b -> case verifyKeyContent b of Nothing -> return True - Just fscker -> fscker k (key2file k) + Just verifier -> verifier k (key2file k) get = getViaTmp k $ \dest -> Remote.retrieveKeyFile r k Nothing dest nullMeterUpdate store = Remote.storeKey r k Nothing nullMeterUpdate |