fsck: Now works in bare repositories.
Checks location log information, and file contents. Does not check that numcopies is satisfied, as .gitattributes information about numcopies is not available in a bare repository. In practice, that should not be a problem, since fsck is also run in a checkout and will check numcopies there.
This commit is contained in:
parent
fef2cf7398
commit
2566eb85fe
7 changed files with 77 additions and 31 deletions
|
@ -17,6 +17,7 @@ module Logs.Location (
|
|||
readLog,
|
||||
keyLocations,
|
||||
loggedKeys,
|
||||
loggedKeysFor,
|
||||
logFile,
|
||||
logFileKey
|
||||
) where
|
||||
|
@ -44,6 +45,18 @@ keyLocations = currentLog . logFile
|
|||
loggedKeys :: Annex [Key]
|
||||
loggedKeys = mapMaybe (logFileKey . takeFileName) <$> Annex.Branch.files
|
||||
|
||||
{- Finds all keys that have location log information indicating
|
||||
- they are present for the specified repository. -}
|
||||
loggedKeysFor :: UUID -> Annex [Key]
|
||||
loggedKeysFor u = filterM isthere =<< loggedKeys
|
||||
where
|
||||
{- This should run strictly to avoid the filterM
|
||||
- building many thunks containing keyLocations data. -}
|
||||
isthere k = do
|
||||
us <- keyLocations k
|
||||
let !there = u `elem` us
|
||||
return there
|
||||
|
||||
{- The filename of the log file for a given key. -}
|
||||
logFile :: Key -> String
|
||||
logFile key = hashDirLower key ++ keyFile key ++ ".log"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue