diff options
author | Joey Hess <joeyh@joeyh.name> | 2015-10-02 12:38:02 -0400 |
---|---|---|
committer | Joey Hess <joeyh@joeyh.name> | 2015-10-02 12:38:02 -0400 |
commit | 1292c38a52e103ff49642968adf2e6c8d01f35ad (patch) | |
tree | b5da97a4ceea05ee1881be1d1d74156b02bd0d26 | |
parent | c3b38fb2a075b4250e867ebd910324c65712c747 (diff) |
disabling verification also disables size verification
It's not expensive to do size verification, but let's be consistent and
turn it off too.
-rw-r--r-- | Annex/Content.hs | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/Annex/Content.hs b/Annex/Content.hs index 34d4957bf..266cb9ac1 100644 --- a/Annex/Content.hs +++ b/Annex/Content.hs @@ -245,28 +245,28 @@ getViaTmp' v key action = do ) {- Verifies that a file is the expected content of a key. + - Configuration can prevent verification, for either a + - particular remote or always. - - Most keys have a known size, and if so, the file size is checked. - - This is not expensive, so is always done. - - When the key's backend allows verifying the content (eg via checksum), - - it is checked. This is an expensive check, so configuration can prevent - - it, for either a particular remote or always. + - it is checked. -} verifyKeyContent :: Verify -> Key -> FilePath -> Annex Bool -verifyKeyContent v k f = verifysize <&&> verifycontent +verifyKeyContent v k f = ifM (shouldVerify v) + ( verifysize <&&> verifycontent + , return True + ) where verifysize = case Types.Key.keySize k of Nothing -> return True Just size -> do size' <- liftIO $ catchDefaultIO 0 $ getFileSize f return (size' == size) - verifycontent = ifM (shouldVerify v) - ( case Types.Backend.verifyKeyContent =<< Backend.maybeLookupBackendName (Types.Key.keyBackendName k) of - Nothing -> return True - Just verifier -> verifier k f - , return True - ) + verifycontent = case Types.Backend.verifyKeyContent =<< Backend.maybeLookupBackendName (Types.Key.keyBackendName k) of + Nothing -> return True + Just verifier -> verifier k f data Verify = AlwaysVerify | NoVerify | RemoteVerify Remote | DefaultVerify |