AssociatedFile newtype

To prevent any further mistakes like 301aff34c4

This commit was sponsored by Francois Marier on Patreon.
This commit is contained in:
Joey Hess 2017-03-10 13:12:24 -04:00
parent 2cd7496210
commit c8e1e3dada
No known key found for this signature in database
GPG key ID: C910D9222512E3C7
43 changed files with 179 additions and 138 deletions

View file

@ -65,7 +65,7 @@ seek o = allowConcurrentOutput $
start :: DropOptions -> FilePath -> Key -> CommandStart
start o file key = start' o key afile (mkActionItem afile)
where
afile = Just file
afile = AssociatedFile (Just file)
start' :: DropOptions -> Key -> AssociatedFile -> ActionItem -> CommandStart
start' o key afile ai = do
@ -85,7 +85,7 @@ start' o key afile ai = do
| otherwise = return True
startKeys :: DropOptions -> Key -> ActionItem -> CommandStart
startKeys o key = start' o key Nothing
startKeys o key = start' o key (AssociatedFile Nothing)
startLocal :: AssociatedFile -> ActionItem -> NumCopies -> Key -> [VerifiedCopy] -> CommandStart
startLocal afile ai numcopies key preverified = stopUnless (inAnnex key) $ do
@ -202,7 +202,8 @@ requiredContent = do
{- In auto mode, only runs the action if there are enough
- copies on other semitrusted repositories. -}
checkDropAuto :: Bool -> Maybe Remote -> AssociatedFile -> Key -> (NumCopies -> CommandStart) -> CommandStart
checkDropAuto automode mremote afile key a = go =<< maybe getNumCopies getFileNumCopies afile
checkDropAuto automode mremote (AssociatedFile afile) key a =
go =<< maybe getNumCopies getFileNumCopies afile
where
go numcopies
| automode = do