aboutsummaryrefslogtreecommitdiff
path: root/Command
diff options
context:
space:
mode:
authorGravatar Joey Hess <joeyh@joeyh.name>2018-02-08 14:16:00 -0400
committerGravatar Joey Hess <joeyh@joeyh.name>2018-02-08 14:16:00 -0400
commit7f2b5870160010a8c4d0d7d26a64e530ce5b705e (patch)
tree44ad6dece1866f6986a8beba2a5591a4fe651c6b /Command
parent563556e503acc19205cddfe31d1b50f6657633e2 (diff)
optimise for case where there are no required contents
Avoid reading location log in this case.
Diffstat (limited to 'Command')
-rw-r--r--Command/Fsck.hs27
1 files changed, 15 insertions, 12 deletions
diff --git a/Command/Fsck.hs b/Command/Fsck.hs
index 8ca5b1fd0..a536361a8 100644
--- a/Command/Fsck.hs
+++ b/Command/Fsck.hs
@@ -295,21 +295,24 @@ verifyLocationLog' key ai present u updatestatus = do
- checking against the location log. -}
verifyRequiredContent :: Key -> ActionItem -> Annex Bool
verifyRequiredContent key ai@(ActionItemAssociatedFile afile) = do
- presentlocs <- S.fromList <$> loggedLocations key
requiredlocs <- S.fromList . M.keys <$> requiredContentMap
- missinglocs <- filterM
- (\u -> isRequiredContent (Just u) S.empty (Just key) afile False)
- (S.toList $ S.difference requiredlocs presentlocs)
- if null missinglocs
+ if S.null requiredlocs
then return True
else do
- missingrequired <- Remote.prettyPrintUUIDs "missingrequired" missinglocs
- warning $
- "** Required content " ++
- actionItemDesc ai key ++
- " is missing from these repositories:\n" ++
- missingrequired
- return False
+ presentlocs <- S.fromList <$> loggedLocations key
+ missinglocs <- filterM
+ (\u -> isRequiredContent (Just u) S.empty (Just key) afile False)
+ (S.toList $ S.difference requiredlocs presentlocs)
+ if null missinglocs
+ then return True
+ else do
+ missingrequired <- Remote.prettyPrintUUIDs "missingrequired" missinglocs
+ warning $
+ "** Required content " ++
+ actionItemDesc ai key ++
+ " is missing from these repositories:\n" ++
+ missingrequired
+ return False
verifyRequiredContent _ _ = return True
{- Verifies the associated file records. -}