This commit is contained in:
Joey Hess 2021-08-18 13:35:53 -04:00
parent 449851225a
commit 325bfda12d
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
2 changed files with 13 additions and 8 deletions
Annex
Remote

View file

@ -16,6 +16,7 @@ module Annex.Verify (
warnUnverifiableInsecure,
isVerifiable,
startVerifyKeyContentIncrementally,
finishVerifyKeyContentIncrementally,
IncrementalVerifier(..),
tailVerify,
) where
@ -167,6 +168,17 @@ startVerifyKeyContentIncrementally verifyconfig k =
, return Nothing
)
finishVerifyKeyContentIncrementally :: Maybe IncrementalVerifier -> Annex (Bool, Verification)
finishVerifyKeyContentIncrementally Nothing =
return (True, UnVerified)
finishVerifyKeyContentIncrementally (Just iv) =
ifM (liftIO $ finalizeIncremental iv)
( return (True, Verified)
, do
warning "verification of content failed"
return (False, UnVerified)
)
-- | Reads the file as it grows, and feeds it to the incremental verifier.
--
-- The TMVar must start out empty, and be filled once whatever is

View file

@ -867,14 +867,7 @@ mkFileCopier remotewanthardlink (State _ _ copycowtried _ _) = do
iv <- startVerifyKeyContentIncrementally verifyconfig k
fileCopier copycowtried src dest p iv >>= \case
Copied -> ifM check
( case iv of
Just x -> ifM (liftIO $ finalizeIncremental x)
( return (True, Verified)
, do
warning "verification of content failed"
return (False, UnVerified)
)
Nothing -> return (True, UnVerified)
( finishVerifyKeyContentIncrementally iv
, return (False, UnVerified)
)
CopiedCoW -> unVerified check