fix fsck --from --all to not fall over trying to check required content
fsck: When --from is used in combination with --all or similar options, do not verify required content, which can't be checked properly when operating on keys. This commit was sponsored by Boyd Stephen Smith Jr. on Patreon.
This commit is contained in:
parent
b8df74c016
commit
637229c593
4 changed files with 74 additions and 19 deletions
|
@ -306,25 +306,30 @@ verifyLocationLog' key ai present u updatestatus = do
|
|||
{- Verifies that all repos that are required to contain the content do,
|
||||
- checking against the location log. -}
|
||||
verifyRequiredContent :: Key -> ActionItem -> Annex Bool
|
||||
verifyRequiredContent key ai@(ActionItemAssociatedFile afile _) = do
|
||||
requiredlocs <- S.fromList . M.keys <$> requiredContentMap
|
||||
if S.null requiredlocs
|
||||
then return True
|
||||
else do
|
||||
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 " ++
|
||||
decodeBS' (actionItemDesc ai) ++
|
||||
" is missing from these repositories:\n" ++
|
||||
missingrequired
|
||||
return False
|
||||
verifyRequiredContent key ai@(ActionItemAssociatedFile afile _) = case afile of
|
||||
-- Can't be checked if there's no associated file.
|
||||
AssociatedFile Nothing -> return True
|
||||
AssociatedFile (Just _) -> do
|
||||
requiredlocs <- S.fromList . M.keys <$> requiredContentMap
|
||||
if S.null requiredlocs
|
||||
then return True
|
||||
else go requiredlocs
|
||||
where
|
||||
go requiredlocs = do
|
||||
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 " ++
|
||||
decodeBS' (actionItemDesc ai) ++
|
||||
" is missing from these repositories:\n" ++
|
||||
missingrequired
|
||||
return False
|
||||
verifyRequiredContent _ _ = return True
|
||||
|
||||
{- Verifies the associated file records. -}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue