summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Joey Hess <joeyh@joeyh.name>2016-02-14 17:27:50 -0400
committerGravatar Joey Hess <joeyh@joeyh.name>2016-02-14 17:27:50 -0400
commit32ffc4fd71743b7fcad81c4a3bf93e234e0f3c6d (patch)
tree83e3d6453a6fc53bea4201ca7f5c3dbc7b059fee
parent1d1ecd4d89160b8bdbef0179ceb519f00bbe16eb (diff)
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 f9dfeaf801da2e4d5879b3de5895dc3cef68a329
-rw-r--r--Command/Fsck.hs34
-rw-r--r--debian/changelog2
-rw-r--r--doc/bugs/__39__git_annex_get__39___fails_for_unlocked_files_with_special_characters___40__e.g._umlauts__41___when_using_precompiled_version_6.20160126-g2336107_.mdwn1
-rw-r--r--doc/bugs/__39__git_annex_get__39___fails_for_unlocked_files_with_special_characters___40__e.g._umlauts__41___when_using_precompiled_version_6.20160126-g2336107_/comment_2_1c547ab07cf57cfa9eb5398629e27d56._comment7
4 files changed, 37 insertions, 7 deletions
diff --git a/Command/Fsck.hs b/Command/Fsck.hs
index 7341ab5e5..3b31b7211 100644
--- a/Command/Fsck.hs
+++ b/Command/Fsck.hs
@@ -1,6 +1,6 @@
{- 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.
-}
@@ -25,6 +25,7 @@ import Logs.Activity
import Logs.TimeStamp
import Annex.NumCopies
import Annex.UUID
+import Annex.ReplaceFile
import Utility.DataUnits
import Config
import Utility.HumanTime
@@ -120,7 +121,7 @@ perform key file backend numcopies = do
[ fixLink key file
, verifyLocationLog key keystatus file
, verifyAssociatedFiles key keystatus file
- , verifyDirectMode key file
+ , verifyWorkTree key file
, checkKeySize key keystatus
, checkBackend backend key keystatus (Just file)
, checkKeyNumCopies key (Just file) numcopies
@@ -280,17 +281,36 @@ verifyAssociatedFiles key keystatus file = do
Database.Keys.addAssociatedFile key f
_ -> return ()
-{- Ensures that files whose content is available are in direct mode. -}
-verifyDirectMode :: Key -> FilePath -> Annex Bool
-verifyDirectMode key file = do
- whenM (isDirect <&&> isJust <$> isAnnexLink file) $ do
+verifyWorkTree :: Key -> FilePath -> Annex Bool
+verifyWorkTree key file = do
+ ifM isDirect ( godirect, goindirect )
+ return True
+ where
+ {- Ensures that files whose content is available are in direct mode. -}
+ godirect = whenM (isJust <$> isAnnexLink file) $ do
v <- toDirectGen key file
case v of
Nothing -> noop
Just a -> do
showNote "fixing direct mode"
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 key's metadata, if available.
diff --git a/debian/changelog b/debian/changelog
index c7d9bd8a7..b93d7ba91 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -9,6 +9,8 @@ git-annex (6.20160212) UNRELEASED; urgency=medium
* Fix storing of filenames of v6 unlocked files when the filename is not
representable in the current locale.
* 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
diff --git a/doc/bugs/__39__git_annex_get__39___fails_for_unlocked_files_with_special_characters___40__e.g._umlauts__41___when_using_precompiled_version_6.20160126-g2336107_.mdwn b/doc/bugs/__39__git_annex_get__39___fails_for_unlocked_files_with_special_characters___40__e.g._umlauts__41___when_using_precompiled_version_6.20160126-g2336107_.mdwn
index b59f7ea94..1225643f4 100644
--- a/doc/bugs/__39__git_annex_get__39___fails_for_unlocked_files_with_special_characters___40__e.g._umlauts__41___when_using_precompiled_version_6.20160126-g2336107_.mdwn
+++ b/doc/bugs/__39__git_annex_get__39___fails_for_unlocked_files_with_special_characters___40__e.g._umlauts__41___when_using_precompiled_version_6.20160126-g2336107_.mdwn
@@ -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 :-)
+> [[fixed|done]] --[[Joey]]
diff --git a/doc/bugs/__39__git_annex_get__39___fails_for_unlocked_files_with_special_characters___40__e.g._umlauts__41___when_using_precompiled_version_6.20160126-g2336107_/comment_2_1c547ab07cf57cfa9eb5398629e27d56._comment b/doc/bugs/__39__git_annex_get__39___fails_for_unlocked_files_with_special_characters___40__e.g._umlauts__41___when_using_precompiled_version_6.20160126-g2336107_/comment_2_1c547ab07cf57cfa9eb5398629e27d56._comment
new file mode 100644
index 000000000..ee1c70781
--- /dev/null
+++ b/doc/bugs/__39__git_annex_get__39___fails_for_unlocked_files_with_special_characters___40__e.g._umlauts__41___when_using_precompiled_version_6.20160126-g2336107_/comment_2_1c547ab07cf57cfa9eb5398629e27d56._comment
@@ -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.
+"""]]