add support for using hashDirLower in addition to hashDirMixed
Supporting multiple directory hash types will allow converting to a different one, without a flag day. gitAnnexLocation now checks which of the possible locations have a file. This means more statting of files. Several places currently use gitAnnexLocation and immediately check if the returned file exists; those need to be optimised.
This commit is contained in:
parent
2b3c120506
commit
da9cd315be
15 changed files with 73 additions and 44 deletions
|
@ -60,7 +60,7 @@ undo file key e = do
|
|||
-- fromAnnex could fail if the file ownership is weird
|
||||
tryharder :: IOException -> Annex ()
|
||||
tryharder _ = do
|
||||
src <- fromRepo $ gitAnnexLocation key
|
||||
src <- inRepo $ gitAnnexLocation key
|
||||
liftIO $ moveFile src file
|
||||
|
||||
cleanup :: FilePath -> Key -> Bool -> CommandCleanup
|
||||
|
|
|
@ -87,7 +87,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 $ do
|
||||
f <- fromRepo $ gitAnnexLocation key
|
||||
f <- inRepo $ gitAnnexLocation key
|
||||
liftIO $ do
|
||||
preventWrite f
|
||||
preventWrite (parentDir f)
|
||||
|
@ -118,7 +118,7 @@ verifyLocationLog key desc = do
|
|||
- the key's metadata, if available. -}
|
||||
checkKeySize :: Key -> Annex Bool
|
||||
checkKeySize key = do
|
||||
file <- fromRepo $ gitAnnexLocation key
|
||||
file <- inRepo $ gitAnnexLocation key
|
||||
present <- liftIO $ doesFileExist file
|
||||
case (present, Types.Key.keySize key) of
|
||||
(_, Nothing) -> return True
|
||||
|
|
|
@ -49,7 +49,7 @@ upgradableKey key = isNothing $ Types.Key.keySize key
|
|||
-}
|
||||
perform :: FilePath -> Key -> Backend Annex -> CommandPerform
|
||||
perform file oldkey newbackend = do
|
||||
src <- fromRepo $ gitAnnexLocation oldkey
|
||||
src <- inRepo $ gitAnnexLocation oldkey
|
||||
tmp <- fromRepo gitAnnexTmpDir
|
||||
let tmpfile = tmp </> takeFileName file
|
||||
cleantmp tmpfile
|
||||
|
|
|
@ -21,7 +21,7 @@ seek = [withKeys start]
|
|||
|
||||
start :: Key -> CommandStart
|
||||
start key = do
|
||||
file <- fromRepo $ gitAnnexLocation key
|
||||
file <- inRepo $ gitAnnexLocation key
|
||||
whenM (inAnnex key) $
|
||||
liftIO $ rsyncServerSend file -- does not return
|
||||
warning "requested key is not present"
|
||||
|
|
|
@ -55,7 +55,7 @@ cleanup file key = do
|
|||
if fast
|
||||
then do
|
||||
-- fast mode: hard link to content in annex
|
||||
src <- fromRepo $ gitAnnexLocation key
|
||||
src <- inRepo $ gitAnnexLocation key
|
||||
liftIO $ do
|
||||
createLink src file
|
||||
allowWrite file
|
||||
|
|
|
@ -37,7 +37,7 @@ perform dest key = do
|
|||
|
||||
checkDiskSpace key
|
||||
|
||||
src <- fromRepo $ gitAnnexLocation key
|
||||
src <- inRepo $ gitAnnexLocation key
|
||||
tmpdest <- fromRepo $ gitAnnexTmpLocation key
|
||||
liftIO $ createDirectoryIfMissing True (parentDir tmpdest)
|
||||
showAction "copying"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue