fsck: Populate unlocked files in v6 repositories whose content is present in annex/objects but didn't reach the work tree.
This also handles fixing up after cf260d9a15
This commit is contained in:
parent
675321264f
commit
885e54df0a
4 changed files with 37 additions and 7 deletions
|
@ -1,6 +1,6 @@
|
||||||
{- git-annex command
|
{- git-annex command
|
||||||
-
|
-
|
||||||
- Copyright 2010-2015 Joey Hess <id@joeyh.name>
|
- Copyright 2010-2016 Joey Hess <id@joeyh.name>
|
||||||
-
|
-
|
||||||
- Licensed under the GNU GPL version 3 or higher.
|
- Licensed under the GNU GPL version 3 or higher.
|
||||||
-}
|
-}
|
||||||
|
@ -25,6 +25,7 @@ import Logs.Activity
|
||||||
import Logs.TimeStamp
|
import Logs.TimeStamp
|
||||||
import Annex.NumCopies
|
import Annex.NumCopies
|
||||||
import Annex.UUID
|
import Annex.UUID
|
||||||
|
import Annex.ReplaceFile
|
||||||
import Utility.DataUnits
|
import Utility.DataUnits
|
||||||
import Config
|
import Config
|
||||||
import Utility.HumanTime
|
import Utility.HumanTime
|
||||||
|
@ -120,7 +121,7 @@ perform key file backend numcopies = do
|
||||||
[ fixLink key file
|
[ fixLink key file
|
||||||
, verifyLocationLog key keystatus file
|
, verifyLocationLog key keystatus file
|
||||||
, verifyAssociatedFiles key keystatus file
|
, verifyAssociatedFiles key keystatus file
|
||||||
, verifyDirectMode key file
|
, verifyWorkTree key file
|
||||||
, checkKeySize key keystatus
|
, checkKeySize key keystatus
|
||||||
, checkBackend backend key keystatus (Just file)
|
, checkBackend backend key keystatus (Just file)
|
||||||
, checkKeyNumCopies key (Just file) numcopies
|
, checkKeyNumCopies key (Just file) numcopies
|
||||||
|
@ -280,17 +281,36 @@ verifyAssociatedFiles key keystatus file = do
|
||||||
Database.Keys.addAssociatedFile key f
|
Database.Keys.addAssociatedFile key f
|
||||||
_ -> return ()
|
_ -> return ()
|
||||||
|
|
||||||
{- Ensures that files whose content is available are in direct mode. -}
|
verifyWorkTree :: Key -> FilePath -> Annex Bool
|
||||||
verifyDirectMode :: Key -> FilePath -> Annex Bool
|
verifyWorkTree key file = do
|
||||||
verifyDirectMode key file = do
|
ifM isDirect ( godirect, goindirect )
|
||||||
whenM (isDirect <&&> isJust <$> isAnnexLink file) $ do
|
return True
|
||||||
|
where
|
||||||
|
{- Ensures that files whose content is available are in direct mode. -}
|
||||||
|
godirect = whenM (isJust <$> isAnnexLink file) $ do
|
||||||
v <- toDirectGen key file
|
v <- toDirectGen key file
|
||||||
case v of
|
case v of
|
||||||
Nothing -> noop
|
Nothing -> noop
|
||||||
Just a -> do
|
Just a -> do
|
||||||
showNote "fixing direct mode"
|
showNote "fixing direct mode"
|
||||||
a
|
a
|
||||||
return True
|
{- Make sure that a pointer file is replaced with its content,
|
||||||
|
- when the content is available. -}
|
||||||
|
goindirect = do
|
||||||
|
mk <- liftIO $ isPointerFile file
|
||||||
|
case mk of
|
||||||
|
Just k | k == key -> whenM (inAnnex key) $ do
|
||||||
|
showNote "fixing worktree content"
|
||||||
|
replaceFile file $ \tmp ->
|
||||||
|
ifM (annexThin <$> Annex.getGitConfig)
|
||||||
|
( void $ linkFromAnnex key tmp
|
||||||
|
, do
|
||||||
|
obj <- calcRepo $ gitAnnexLocation key
|
||||||
|
void $ checkedCopyFile key obj tmp
|
||||||
|
thawContent tmp
|
||||||
|
)
|
||||||
|
Database.Keys.storeInodeCaches key [file]
|
||||||
|
_ -> return ()
|
||||||
|
|
||||||
{- The size of the data for a key is checked against the size encoded in
|
{- The size of the data for a key is checked against the size encoded in
|
||||||
- the key's metadata, if available.
|
- the key's metadata, if available.
|
||||||
|
|
2
debian/changelog
vendored
2
debian/changelog
vendored
|
@ -9,6 +9,8 @@ git-annex (6.20160212) UNRELEASED; urgency=medium
|
||||||
* Fix storing of filenames of v6 unlocked files when the filename is not
|
* Fix storing of filenames of v6 unlocked files when the filename is not
|
||||||
representable in the current locale.
|
representable in the current locale.
|
||||||
* fsck: Detect and fix missing associated file mappings in v6 repositories.
|
* fsck: Detect and fix missing associated file mappings in v6 repositories.
|
||||||
|
* fsck: Populate unlocked files in v6 repositories whose content is
|
||||||
|
present in annex/objects but didn't reach the work tree.
|
||||||
|
|
||||||
-- Joey Hess <id@joeyh.name> Fri, 12 Feb 2016 14:03:46 -0400
|
-- Joey Hess <id@joeyh.name> Fri, 12 Feb 2016 14:03:46 -0400
|
||||||
|
|
||||||
|
|
|
@ -74,3 +74,4 @@ I tested this on two different systems, Arch Linux and Debian Jessie. It does no
|
||||||
|
|
||||||
Yes, I've been using it for more than a year to synchronize between different PCs. Great work :-)
|
Yes, I've been using it for more than a year to synchronize between different PCs. Great work :-)
|
||||||
|
|
||||||
|
> [[fixed|done]] --[[Joey]]
|
||||||
|
|
|
@ -0,0 +1,7 @@
|
||||||
|
[[!comment format=mdwn
|
||||||
|
username="joey"
|
||||||
|
subject="""comment 2"""
|
||||||
|
date="2016-02-14T21:10:53Z"
|
||||||
|
content="""
|
||||||
|
`git annex fsck` will now clean up repos affected by this problem.
|
||||||
|
"""]]
|
Loading…
Reference in a new issue