diff --git a/Upgrade/V5.hs b/Upgrade/V5.hs index 98ec5df091..3ed6288ed6 100644 --- a/Upgrade/V5.hs +++ b/Upgrade/V5.hs @@ -15,6 +15,8 @@ import Annex.InodeSentinal import Annex.Link import Annex.CatFile import Annex.WorkTree +import Annex.UUID +import Logs.Location import qualified Annex.Content as Content import qualified Database.Keys import qualified Annex.Direct as Direct @@ -102,14 +104,24 @@ upgradeDirectWorkTree = do =<< inRepo (toTopFilePath f) go _ = noop - fromdirect f k = whenM (Direct.goodContent k f) $ do - -- If linkToAnnex fails for some reason, the work tree file - -- still has the content; the annex object file is just - -- not populated with it. Since the work tree file - -- is recorded as an associated file, things will still - -- work that way, it's just not ideal. - ic <- withTSDelta (liftIO . genInodeCache f) - void $ Content.linkToAnnex k f ic + fromdirect f k = ifM (Direct.goodContent k f) + ( do + -- If linkToAnnex fails for some reason, the work tree + -- file still has the content; the annex object file + -- is just not populated with it. Since the work tree + -- file is recorded as an associated file, things will + -- still work that way, it's just not ideal. + ic <- withTSDelta (liftIO . genInodeCache f) + void $ Content.linkToAnnex k f ic + , unlessM (Content.inAnnex k) $ do + -- Worktree file was deleted or modified; + -- if there are no other copies of the content + -- then it's been lost. + locs <- Direct.associatedFiles k + unlessM (anyM (Direct.goodContent k) locs) $ do + u <- getUUID + logChange k u InfoMissing + ) writepointer f k = liftIO $ do nukeFile f diff --git a/doc/bugs/direct_mode_upgrade_with_deleted_file.mdwn b/doc/bugs/direct_mode_upgrade_with_deleted_file.mdwn index c62f2a396b..dd9eb69720 100644 --- a/doc/bugs/direct_mode_upgrade_with_deleted_file.mdwn +++ b/doc/bugs/direct_mode_upgrade_with_deleted_file.mdwn @@ -8,6 +8,8 @@ But `git whereis` thinks the content is present, which it's not any longer. Seems that the upgrade process needs to notice when a deleted file was the only copy of the content, and set its content as not present. +> [[done]] --[[Joey]] + And `git fsck` doesn't find a problem, despite the content not being present. And does not fix the location log. This part may not be specific to this case, seems it must be some bug in