convert KeySource to RawFilePath
This commit is contained in:
parent
e468fbc518
commit
c31e1be781
14 changed files with 74 additions and 55 deletions
|
@ -90,7 +90,7 @@ hashKeyVariety (Blake2spHash size) he = Blake2spKey size he
|
|||
{- A key is a hash of its contents. -}
|
||||
keyValue :: Hash -> KeySource -> MeterUpdate -> Annex (Maybe Key)
|
||||
keyValue hash source meterupdate = do
|
||||
let file = contentLocation source
|
||||
let file = fromRawFilePath (contentLocation source)
|
||||
filesize <- liftIO $ getFileSize file
|
||||
s <- hashFile hash file meterupdate
|
||||
return $ Just $ mkKey $ \k -> k
|
||||
|
@ -106,7 +106,7 @@ keyValueE hash source meterupdate =
|
|||
where
|
||||
addE k = do
|
||||
maxlen <- annexMaxExtensionLength <$> Annex.getGitConfig
|
||||
let ext = selectExtension maxlen (toRawFilePath (keyFilename source))
|
||||
let ext = selectExtension maxlen (keyFilename source)
|
||||
return $ Just $ alterKey k $ \d -> d
|
||||
{ keyName = keyName d <> ext
|
||||
, keyVariety = hashKeyVariety hash (HasExt True)
|
||||
|
|
|
@ -16,6 +16,7 @@ import Git.FilePath
|
|||
import Utility.Metered
|
||||
|
||||
import qualified Data.ByteString.Char8 as S8
|
||||
import qualified Utility.RawFilePath as R
|
||||
|
||||
backends :: [Backend]
|
||||
backends = [backend]
|
||||
|
@ -36,10 +37,10 @@ backend = Backend
|
|||
keyValue :: KeySource -> MeterUpdate -> Annex (Maybe Key)
|
||||
keyValue source _ = do
|
||||
let f = contentLocation source
|
||||
stat <- liftIO $ getFileStatus f
|
||||
sz <- liftIO $ getFileSize' f stat
|
||||
stat <- liftIO $ R.getFileStatus f
|
||||
sz <- liftIO $ getFileSize' (fromRawFilePath f) stat
|
||||
relf <- fromRawFilePath . getTopFilePath
|
||||
<$> inRepo (toTopFilePath $ toRawFilePath $ keyFilename source)
|
||||
<$> inRepo (toTopFilePath $ keyFilename source)
|
||||
return $ Just $ mkKey $ \k -> k
|
||||
{ keyName = genKeyName relf
|
||||
, keyVariety = WORMKey
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue