diff options
author | Joey Hess <joey@kitenet.net> | 2013-04-04 15:46:33 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2013-04-04 15:46:33 -0400 |
commit | a7cc06b30d3ae8a9801a68729db23dd66f8dadf6 (patch) | |
tree | b500f785b37815cf82d82da299881e07931ab27c /Command | |
parent | 307212395c912ab268109521ceae1bf192f728d8 (diff) |
Use lower case hash directories for storing files on crippled filesystems, same as is already done for bare repositories.
* since this is a crippled filesystem anyway, git-annex doesn't use
symlinks on it
* so there's no reason to use the mixed case hash directories that we're
stuck using to avoid breaking everyone's symlinks to the content
* so we can do what is already done for all bare repos, and make non-bare
repos on crippled filesystems use the all-lower case hash directories
* which are, happily, all 3 letters long, so they cannot conflict with
mixed case hash directories
* so I was able to 100% fix this and even resuming `git annex add` in the
test case will recover and it will all just work.
Diffstat (limited to 'Command')
-rw-r--r-- | Command/Add.hs | 8 | ||||
-rw-r--r-- | Command/Fix.hs | 3 | ||||
-rw-r--r-- | Command/FromKey.hs | 2 | ||||
-rw-r--r-- | Command/Fsck.hs | 12 | ||||
-rw-r--r-- | Command/Indirect.hs | 6 | ||||
-rw-r--r-- | Command/Migrate.hs | 2 | ||||
-rw-r--r-- | Command/ReKey.hs | 2 | ||||
-rw-r--r-- | Command/Sync.hs | 3 | ||||
-rw-r--r-- | Command/Unannex.hs | 2 | ||||
-rw-r--r-- | Command/Unlock.hs | 2 |
10 files changed, 21 insertions, 21 deletions
diff --git a/Command/Add.hs b/Command/Add.hs index c15f3c51f..30e989e4c 100644 --- a/Command/Add.hs +++ b/Command/Add.hs @@ -168,13 +168,13 @@ undo file key e = do -- fromAnnex could fail if the file ownership is weird tryharder :: IOException -> Annex () tryharder _ = do - src <- inRepo $ gitAnnexLocation key + src <- calcRepo $ gitAnnexLocation key liftIO $ moveFile src file {- Creates the symlink to the annexed content, returns the link target. -} link :: FilePath -> Key -> Bool -> Annex String link file key hascontent = handle (undo file key) $ do - l <- calcGitLink file key + l <- inRepo $ gitAnnexLink file key replaceFile file $ makeAnnexLink l #ifndef __ANDROID__ @@ -206,7 +206,9 @@ cleanup file key hascontent = do when hascontent $ logStatus key InfoPresent ifM (isDirect <&&> pure hascontent) - ( stageSymlink file =<< hashSymlink =<< calcGitLink file key + ( do + l <- inRepo $ gitAnnexLink file key + stageSymlink file =<< hashSymlink l , ifM (coreSymlinks <$> Annex.getGitConfig) ( do _ <- link file key hascontent diff --git a/Command/Fix.hs b/Command/Fix.hs index dbccfacdf..6aedbad6e 100644 --- a/Command/Fix.hs +++ b/Command/Fix.hs @@ -10,7 +10,6 @@ module Command.Fix where import Common.Annex import Command import qualified Annex.Queue -import Annex.Content def :: [Command] def = [notDirect $ noCommit $ command "fix" paramPaths seek @@ -22,7 +21,7 @@ seek = [withFilesInGit $ whenAnnexed start] {- Fixes the symlink to an annexed file. -} start :: FilePath -> (Key, Backend) -> CommandStart start file (key, _) = do - link <- calcGitLink file key + link <- inRepo $ gitAnnexLink file key stopUnless ((/=) (Just link) <$> liftIO (catchMaybeIO $ readSymbolicLink file)) $ do showStart "fix" file next $ perform file link diff --git a/Command/FromKey.hs b/Command/FromKey.hs index ac5edd1d0..30b491478 100644 --- a/Command/FromKey.hs +++ b/Command/FromKey.hs @@ -33,7 +33,7 @@ start _ = error "specify a key and a dest file" perform :: Key -> FilePath -> CommandPerform perform key file = do - link <- calcGitLink file key + link <- inRepo $ gitAnnexLink file key liftIO $ createDirectoryIfMissing True (parentDir file) liftIO $ createSymbolicLink link file next $ cleanup file diff --git a/Command/Fsck.hs b/Command/Fsck.hs index 501483b14..0d70f697b 100644 --- a/Command/Fsck.hs +++ b/Command/Fsck.hs @@ -188,7 +188,7 @@ check cs = all id <$> sequence cs -} fixLink :: Key -> FilePath -> Annex Bool fixLink key file = do - want <- calcGitLink file key + want <- inRepo $ gitAnnexLink file key have <- getAnnexLinkTarget file maybe noop (go want) have return True @@ -223,7 +223,7 @@ verifyLocationLog key desc = do {- Since we're checking that a key's file is present, throw - in a permission fixup here too. -} when (present && not direct) $ do - file <- inRepo $ gitAnnexLocation key + file <- calcRepo $ gitAnnexLocation key freezeContent file freezeContentDir file @@ -281,7 +281,7 @@ checkKeySize :: Key -> Annex Bool checkKeySize key = ifM isDirect ( return True , do - file <- inRepo $ gitAnnexLocation key + file <- calcRepo $ gitAnnexLocation key ifM (liftIO $ doesFileExist file) ( checkKeySizeOr badContent key file , return True @@ -322,7 +322,7 @@ checkKeySizeOr bad key file = case Types.Key.keySize key of -} checkBackend :: Backend -> Key -> Annex Bool checkBackend backend key = do - file <- inRepo $ gitAnnexLocation key + file <- calcRepo $ gitAnnexLocation key ifM isDirect ( ifM (goodContent key file) ( checkBackendOr' (badContentDirect file) backend key file @@ -443,14 +443,14 @@ needFsck _ _ = return True -} recordFsckTime :: Key -> Annex () recordFsckTime key = do - parent <- parentDir <$> inRepo (gitAnnexLocation key) + parent <- parentDir <$> calcRepo (gitAnnexLocation key) liftIO $ void $ tryIO $ do touchFile parent setSticky parent getFsckTime :: Key -> Annex (Maybe EpochTime) getFsckTime key = do - parent <- parentDir <$> inRepo (gitAnnexLocation key) + parent <- parentDir <$> calcRepo (gitAnnexLocation key) liftIO $ catchDefaultIO Nothing $ do s <- getFileStatus parent return $ if isSticky $ fileMode s diff --git a/Command/Indirect.hs b/Command/Indirect.hs index e46a3348d..9ce2751be 100644 --- a/Command/Indirect.hs +++ b/Command/Indirect.hs @@ -82,13 +82,13 @@ perform = do cleandirect k -- clean before content directory gets frozen whenM (liftIO $ not . isSymbolicLink <$> getSymbolicLinkStatus f) $ do moveAnnex k f - l <- calcGitLink f k + l <- inRepo $ gitAnnexLink f k liftIO $ createSymbolicLink l f showEndOk cleandirect k = do - liftIO . nukeFile =<< inRepo (gitAnnexInodeCache k) - liftIO . nukeFile =<< inRepo (gitAnnexMapping k) + liftIO . nukeFile =<< calcRepo (gitAnnexInodeCache k) + liftIO . nukeFile =<< calcRepo (gitAnnexMapping k) cleanup :: CommandCleanup cleanup = do diff --git a/Command/Migrate.hs b/Command/Migrate.hs index 795f9ed7b..e0ef650b0 100644 --- a/Command/Migrate.hs +++ b/Command/Migrate.hs @@ -63,7 +63,7 @@ perform file oldkey oldbackend newbackend = do go newkey = stopUnless (Command.ReKey.linkKey oldkey newkey) $ next $ Command.ReKey.cleanup file oldkey newkey genkey = do - content <- inRepo $ gitAnnexLocation oldkey + content <- calcRepo $ gitAnnexLocation oldkey let source = KeySource { keyFilename = file , contentLocation = content diff --git a/Command/ReKey.hs b/Command/ReKey.hs index 5978a0296..d14edb06d 100644 --- a/Command/ReKey.hs +++ b/Command/ReKey.hs @@ -49,7 +49,7 @@ perform file oldkey newkey = do {- Make a hard link to the old key content, to avoid wasting disk space. -} linkKey :: Key -> Key -> Annex Bool linkKey oldkey newkey = getViaTmpUnchecked newkey $ \tmp -> do - src <- inRepo $ gitAnnexLocation oldkey + src <- calcRepo $ gitAnnexLocation oldkey ifM (liftIO $ doesFileExist tmp) ( return True , ifM crippledFileSystem diff --git a/Command/Sync.hs b/Command/Sync.hs index eb312c25b..a25f6a602 100644 --- a/Command/Sync.hs +++ b/Command/Sync.hs @@ -14,7 +14,6 @@ import qualified Remote import qualified Annex import qualified Annex.Branch import qualified Annex.Queue -import Annex.Content import Annex.Direct import Annex.CatFile import Annex.Link @@ -268,7 +267,7 @@ resolveMerge' u [Just SymlinkBlob, Nothing] makelink (Just key) = do let dest = mergeFile file key - l <- calcGitLink dest key + l <- inRepo $ gitAnnexLink dest key liftIO $ nukeFile dest addAnnexLink l dest whenM (isDirect) $ diff --git a/Command/Unannex.hs b/Command/Unannex.hs index 86cc7d00b..53b593f20 100644 --- a/Command/Unannex.hs +++ b/Command/Unannex.hs @@ -60,7 +60,7 @@ cleanup file key = do where goFast = do -- fast mode: hard link to content in annex - src <- inRepo $ gitAnnexLocation key + src <- calcRepo $ gitAnnexLocation key -- creating a hard link could fall; fall back to non fast mode ifM (liftIO $ catchBoolIO $ createLink src file >> return True) ( thawContent file diff --git a/Command/Unlock.hs b/Command/Unlock.hs index 371b423ee..1eba26ff7 100644 --- a/Command/Unlock.hs +++ b/Command/Unlock.hs @@ -35,7 +35,7 @@ perform dest key = do unlessM (inAnnex key) $ error "content not present" unlessM (checkDiskSpace Nothing key 0) $ error "cannot unlock" - src <- inRepo $ gitAnnexLocation key + src <- calcRepo $ gitAnnexLocation key tmpdest <- fromRepo $ gitAnnexTmpLocation key liftIO $ createDirectoryIfMissing True (parentDir tmpdest) showAction "copying" |