fsck: Avoid complaining about required content of dead repositories

requiredContentMap does not exclude dead repos. Usually this is not a
problem because it is used when we are operating on a repository, and in
that case, the repository is not dead (or if it is, the required content
configurations should still be used). But in the case of fsck, this made a
old required content config for a dead repository be warned about in a
situation where it is not a problem.
This commit is contained in:
Joey Hess 2025-03-26 10:30:33 -04:00
parent c45c4fd897
commit cc8f7e9776
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
3 changed files with 8 additions and 3 deletions

View file

@ -375,11 +375,13 @@ 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
requiredlocs <- filterM notdead =<< (M.keys <$> requiredContentMap)
if null requiredlocs
then return True
else go requiredlocs
else go (S.fromList requiredlocs)
where
notdead u = (/=) DeadTrusted <$> lookupTrust u
go requiredlocs = do
presentlocs <- S.fromList <$> loggedLocations key
missinglocs <- filterM