summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Command/Fsck.hs14
-rw-r--r--debian/changelog1
2 files changed, 15 insertions, 0 deletions
diff --git a/Command/Fsck.hs b/Command/Fsck.hs
index 2e26b0af6..8f33493b5 100644
--- a/Command/Fsck.hs
+++ b/Command/Fsck.hs
@@ -110,6 +110,7 @@ perform key file backend numcopies = check
-- order matters
[ fixLink key file
, verifyLocationLog key file
+ , verifyDirectMapping key file
, checkKeySize key
, checkBackend backend key
, checkKeyNumCopies key file numcopies
@@ -258,6 +259,19 @@ verifyLocationLog' key desc present u bad = do
showNote "fixing location log"
bad s
+{- Ensures the direct mode mapping file is consistent. Each file
+ - it lists for the key should exist, and the specified file should be
+ - included in it.
+ -}
+verifyDirectMapping :: Key -> FilePath -> Annex Bool
+verifyDirectMapping key file = do
+ whenM isDirect $ do
+ fs <- addAssociatedFile key file
+ forM_ fs $ \f ->
+ unlessM (liftIO $ doesFileExist f) $
+ void $ removeAssociatedFile key f
+ return True
+
{- 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 a8a75c906..ad3a60e2c 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -18,6 +18,7 @@ git-annex (3.20130115) UNRELEASED; urgency=low
* Fix direct mode mapping code to always store direct mode filenames
relative to the top of the repository, even when operating inside a
subdirectory.
+ * fsck: Detect and fix consistency errors in direct mode mapping files.
* Avoid filename encoding errors when writing direct mode mappings.
-- Joey Hess <joeyh@debian.org> Mon, 14 Jan 2013 18:35:01 -0400