From dd573e70105706bd1a769f74af9c3006dab903d0 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sat, 13 Nov 2010 15:40:12 -0400 Subject: [PATCH] fsck bugfixes --- Backend/WORM.hs | 2 +- Core.hs | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/Backend/WORM.hs b/Backend/WORM.hs index e53ec6de76..3749899968 100644 --- a/Backend/WORM.hs +++ b/Backend/WORM.hs @@ -47,7 +47,7 @@ keyValue file = do {- Extracts the file size from a key. -} keySize :: Key -> FileOffset -keySize key = read $ section !! 2 +keySize key = read $ section !! 1 where section = split ":" (keyName key) diff --git a/Core.hs b/Core.hs index 789b369cc8..2a81678aa6 100644 --- a/Core.hs +++ b/Core.hs @@ -207,9 +207,11 @@ fromAnnex key dest = do moveBad :: Key -> Annex FilePath moveBad key = do g <- Annex.gitRepo - let src = parentDir $ annexLocation g key + let src = annexLocation g key let dest = annexBadLocation g - liftIO $ renameDirectory src dest + liftIO $ createDirectoryIfMissing True dest + liftIO $ renameFile src (dest ++ takeFileName src) + liftIO $ removeDirectory (parentDir src) return dest {- List of keys whose content exists in .git/annex/objects/ -}