fix some compile warnings left in yesterday

at least 2 could have caused a crash in some circumstances

This commit was sponsored by Brett Eisenberg on Patreon.
This commit is contained in:
Joey Hess 2020-09-25 10:55:03 -04:00
parent ace02f41b0
commit d81f549385
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
3 changed files with 7 additions and 4 deletions

View file

@ -270,5 +270,6 @@ call (Right sub) = Right $ Operation $ MatchFiles
, matchNeedsFileName = any matchNeedsFileName sub
, matchNeedsFileContent = any matchNeedsFileContent sub
, matchNeedsKey = any matchNeedsKey sub
, matchNeedsLocationLog = any matchNeedsLocationLog sub
}
call (Left err) = Left err

View file

@ -198,8 +198,8 @@ addIn s = do
u <- Remote.nameToUUID name
hereu <- getUUID
addLimit $ if u == hereu && null date
then use True inhere
else use False (inuuid u)
then use True checkinhere
else use False (checkinuuid u)
where
(name, date) = separate (== '@') s
use inhere a = Right $ MatchFiles
@ -209,14 +209,14 @@ addIn s = do
, matchNeedsKey = True
, matchNeedsLocationLog = not inhere
}
inuuid u notpresent key
checkinuuid u notpresent key
| null date = do
us <- Remote.keyLocations key
return $ u `elem` us && u `S.notMember` notpresent
| otherwise = do
us <- loggedLocationsHistorical (RefDate date) key
return $ u `elem` us
inhere notpresent key
checkinhere notpresent key
| S.null notpresent = inAnnex key
| otherwise = do
u <- getUUID

View file

@ -26,11 +26,13 @@ addPreferredContentLimit a = do
nfn <- introspectPreferredRequiredContent matchNeedsFileName Nothing
nfc <- introspectPreferredRequiredContent matchNeedsFileContent Nothing
nk <- introspectPreferredRequiredContent matchNeedsKey Nothing
nl <- introspectPreferredRequiredContent matchNeedsLocationLog Nothing
addLimit $ Right $ MatchFiles
{ matchAction = const a
, matchNeedsFileName = nfn
, matchNeedsFileContent = nfc
, matchNeedsKey = nk
, matchNeedsLocationLog = nl
}
checkWant :: (AssociatedFile -> Annex Bool) -> MatchInfo -> Annex Bool