26 lines
778 B
Haskell
26 lines
778 B
Haskell
|
{- verification
|
||
|
-
|
||
|
- Copyright 2010-2021 Joey Hess <id@joeyh.name>
|
||
|
-
|
||
|
- Licensed under the GNU AGPL version 3 or higher.
|
||
|
-}
|
||
|
|
||
|
module Annex.Verify where
|
||
|
|
||
|
import Annex.Common
|
||
|
import qualified Annex
|
||
|
import qualified Types.Remote
|
||
|
|
||
|
data VerifyConfig = AlwaysVerify | NoVerify | RemoteVerify Remote | DefaultVerify
|
||
|
|
||
|
shouldVerify :: VerifyConfig -> Annex Bool
|
||
|
shouldVerify AlwaysVerify = return True
|
||
|
shouldVerify NoVerify = return False
|
||
|
shouldVerify DefaultVerify = annexVerify <$> Annex.getGitConfig
|
||
|
shouldVerify (RemoteVerify r) =
|
||
|
(shouldVerify DefaultVerify
|
||
|
<&&> pure (remoteAnnexVerify (Types.Remote.gitconfig r)))
|
||
|
-- Export remotes are not key/value stores, so always verify
|
||
|
-- content from them even when verification is disabled.
|
||
|
<||> Types.Remote.isExportSupported r
|