diff options
author | Joey Hess <joeyh@joeyh.name> | 2015-12-22 16:55:49 -0400 |
---|---|---|
committer | Joey Hess <joeyh@joeyh.name> | 2015-12-22 16:55:49 -0400 |
commit | 95c82b2a633f8cc7c3035d75afa8665f78982373 (patch) | |
tree | 1879273af18a1b8bcfd07c943ad55a5a6bc468d9 /Command | |
parent | 08f1265886b5cd8646e73f7ed0013b94d34b5f14 (diff) |
move cleanOldKey into ingest
Diffstat (limited to 'Command')
-rw-r--r-- | Command/Smudge.hs | 30 |
1 files changed, 1 insertions, 29 deletions
diff --git a/Command/Smudge.hs b/Command/Smudge.hs index 2876326b8..5666381b0 100644 --- a/Command/Smudge.hs +++ b/Command/Smudge.hs @@ -74,39 +74,11 @@ clean file = do if isJust (parseLinkOrPointer b) then liftIO $ B.hPut stdout b else ifM (shouldAnnex file) - ( do - k <- ingest file - oldkeys <- filter (/= k) - <$> Database.Keys.getAssociatedKey file - mapM_ (cleanOldKey file) oldkeys - Database.Keys.addAssociatedFile k file - liftIO $ emitPointer k + ( liftIO . emitPointer =<< ingest file , liftIO $ B.hPut stdout b ) stop --- If the file being cleaned was hard linked to the old key's annex object, --- modifying the file will have caused the object to have the wrong content. --- Clean up from that. -cleanOldKey :: FilePath -> Key -> Annex () -cleanOldKey modifiedfile key = do - obj <- calcRepo (gitAnnexLocation key) - caches <- Database.Keys.getInodeCaches key - unlessM (sameInodeCache obj caches) $ do - unlinkAnnex key - fs <- filter (/= modifiedfile) - <$> Database.Keys.getAssociatedFiles key - fs' <- filterM (`sameInodeCache` caches) fs - case fs' of - -- If linkAnnex fails, the file with the content - -- is still present, so no need for any recovery. - (f:_) -> do - ic <- withTSDelta (liftIO . genInodeCache f) - void $ linkAnnex key f ic - _ -> lostcontent - where - lostcontent = logStatus key InfoMissing - shouldAnnex :: FilePath -> Annex Bool shouldAnnex file = do matcher <- largeFilesMatcher |