diff options
author | 2013-06-24 16:26:00 -0400 | |
---|---|---|
committer | 2013-06-24 16:26:00 -0400 | |
commit | ed8d9fe3c9598080f041adffbaf717e8c1c230bb (patch) | |
tree | b22fa36f74c663985b7e5ada89f4098a3ea0cbbd | |
parent | 3e5a73062097468c89f59835991654540a5addbf (diff) |
fsck: Ensures that direct mode is used for files when it's enabled.
A common failure mode for direct mode has been for files to end up still
stored in indirect mode. While I hope that doesn't happen anymore, fsck
should deal with it.
-rw-r--r-- | Command/Fsck.hs | 18 | ||||
-rw-r--r-- | debian/changelog | 1 |
2 files changed, 18 insertions, 1 deletions
diff --git a/Command/Fsck.hs b/Command/Fsck.hs index b95ba7ff7..ce1a28989 100644 --- a/Command/Fsck.hs +++ b/Command/Fsck.hs @@ -1,6 +1,6 @@ {- git-annex command - - - Copyright 2010-2011 Joey Hess <joey@kitenet.net> + - Copyright 2010-2013 Joey Hess <joey@kitenet.net> - - Licensed under the GNU GPL version 3 or higher. -} @@ -20,6 +20,7 @@ import qualified Types.Key import qualified Backend import Annex.Content import Annex.Content.Direct +import Annex.Direct import Annex.Perms import Annex.Link import Logs.Location @@ -120,6 +121,7 @@ perform key file backend numcopies = check [ fixLink key file , verifyLocationLog key file , verifyDirectMapping key file + , verifyDirectMode key file , checkKeySize key , checkBackend backend key (Just file) , checkKeyNumCopies key file numcopies @@ -275,6 +277,20 @@ verifyDirectMapping key file = do void $ removeAssociatedFile key f return True +{- Ensures that files whose content is available are in direct mode. -} +verifyDirectMode :: Key -> FilePath -> Annex Bool +verifyDirectMode key file = do + whenM (isDirect <&&> islink) $ do + v <- toDirectGen key file + case v of + Nothing -> noop + Just a -> do + showNote "fixing direct mode" + a + return True + where + islink = liftIO $ isSymbolicLink <$> getSymbolicLinkStatus file + {- The size of the data for a key is checked against the size encoded in - the key's metadata, if available. - diff --git a/debian/changelog b/debian/changelog index ec41c9147..dcf5e41af 100644 --- a/debian/changelog +++ b/debian/changelog @@ -4,6 +4,7 @@ git-annex (4.20130622) UNRELEASED; urgency=low * assistant: Daily sanity check thread is run niced. * bup: Handle /~/ in bup remote paths. Thanks, Oliver Matthews + * fsck: Ensures that direct mode is used for files when it's enabled. -- Joey Hess <joeyh@debian.org> Fri, 21 Jun 2013 13:16:17 -0400 |