Improve repair of git-annex index file.
Fixes a test case I received where a corrupted repo was repaired, but the git-annex branch was not. The root of the problem was that the MissingObject returned by the repair code was not necessarily a complete set of all objects that might have been deleted during the repair. So, stop trying to return that at all, and instead make the index file checking code explicitly verify that each object the index uses is present.
This commit is contained in:
parent
714e031d19
commit
ce045a51af
6 changed files with 53 additions and 50 deletions
|
@ -98,10 +98,10 @@ runRepair u mrmt destructiverepair = do
|
|||
liftIO $ catchBoolIO a
|
||||
|
||||
repair fsckresults referencerepo = do
|
||||
(ok, stillmissing, modifiedbranches) <- inRepo $
|
||||
(ok, modifiedbranches) <- inRepo $
|
||||
runRepairOf fsckresults destructiverepair referencerepo
|
||||
when destructiverepair $
|
||||
repairAnnexBranch stillmissing modifiedbranches
|
||||
repairAnnexBranch modifiedbranches
|
||||
return ok
|
||||
|
||||
backgroundfsck params = liftIO $ void $ async $ do
|
||||
|
|
|
@ -29,7 +29,6 @@ import Git.Repair
|
|||
import Git.Index
|
||||
|
||||
import Data.Time.Clock.POSIX
|
||||
import qualified Data.Set as S
|
||||
|
||||
{- This thread runs once at startup, and most other threads wait for it
|
||||
- to finish. (However, the webapp thread does not, to prevent the UI
|
||||
|
@ -41,7 +40,7 @@ sanityCheckerStartupThread startupdelay = namedThreadUnchecked "SanityCheckerSta
|
|||
|
||||
{- A corrupt index file can prevent the assistant from working at
|
||||
- all, so detect and repair. -}
|
||||
ifM (not <$> liftAnnex (inRepo (checkIndex S.empty)))
|
||||
ifM (not <$> liftAnnex (inRepo checkIndexFast))
|
||||
( do
|
||||
notice ["corrupt index file found at startup; removing and restaging"]
|
||||
liftAnnex $ inRepo $ nukeFile . indexFile
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue