summaryrefslogtreecommitdiff
path: root/Remote
diff options
context:
space:
mode:
authorGravatar Joey Hess <joeyh@joeyh.name>2015-01-28 15:55:17 -0400
committerGravatar Joey Hess <joeyh@joeyh.name>2015-01-28 15:55:17 -0400
commit7ca8ec00a7fcda71a08d22f06838424765a1b215 (patch)
treeaa377fccb40797a734372127c19177524fa8af2b /Remote
parent3327618e5b48afb10a8f98afe15c750d8ed4c416 (diff)
groundwork for parameterizing hash depth
Diffstat (limited to 'Remote')
-rw-r--r--Remote/Directory.hs3
-rw-r--r--Remote/External.hs3
-rw-r--r--Remote/GCrypt.hs3
-rw-r--r--Remote/Hook.hs7
-rw-r--r--Remote/Rsync.hs3
-rw-r--r--Remote/Rsync/RsyncUrl.hs3
-rw-r--r--Remote/WebDAV/DavLocation.hs5
7 files changed, 17 insertions, 10 deletions
diff --git a/Remote/Directory.hs b/Remote/Directory.hs
index 2b887a82f..2eeb79317 100644
--- a/Remote/Directory.hs
+++ b/Remote/Directory.hs
@@ -15,6 +15,7 @@ module Remote.Directory (
import qualified Data.ByteString.Lazy as L
import qualified Data.Map as M
+import Data.Default
import Common.Annex
import Types.Remote
@@ -107,7 +108,7 @@ getLocation d k = do
{- Directory where the file(s) for a key are stored. -}
storeDir :: FilePath -> Key -> FilePath
-storeDir d k = addTrailingPathSeparator $ d </> hashDirLower k </> keyFile k
+storeDir d k = addTrailingPathSeparator $ d </> hashDirLower def k </> keyFile k
{- Where we store temporary data for a key, in the directory, as it's being
- written. -}
diff --git a/Remote/External.hs b/Remote/External.hs
index 0ec284ff4..b660c4f1b 100644
--- a/Remote/External.hs
+++ b/Remote/External.hs
@@ -28,6 +28,7 @@ import Creds
import Control.Concurrent.STM
import System.Log.Logger (debugM)
import qualified Data.Map as M
+import Data.Default
remote :: RemoteType
remote = RemoteType {
@@ -184,7 +185,7 @@ handleRequest' lck external req mp responsehandler
handleRemoteRequest (PROGRESS bytesprocessed) =
maybe noop (\a -> liftIO $ a bytesprocessed) mp
handleRemoteRequest (DIRHASH k) =
- send $ VALUE $ hashDirMixed k
+ send $ VALUE $ hashDirMixed def k
handleRemoteRequest (SETCONFIG setting value) =
liftIO $ atomically $ do
let v = externalConfig external
diff --git a/Remote/GCrypt.hs b/Remote/GCrypt.hs
index b977750c3..aed54d20f 100644
--- a/Remote/GCrypt.hs
+++ b/Remote/GCrypt.hs
@@ -16,6 +16,7 @@ module Remote.GCrypt (
import qualified Data.Map as M
import qualified Data.ByteString.Lazy as L
import Control.Exception
+import Data.Default
import Common.Annex
import Types.Remote
@@ -361,7 +362,7 @@ checkKey r rsyncopts k
{- Annexed objects are hashed using lower-case directories for max
- portability. -}
gCryptLocation :: Remote -> Key -> FilePath
-gCryptLocation r key = Git.repoLocation (repo r) </> objectDir </> keyPath key hashDirLower
+gCryptLocation r key = Git.repoLocation (repo r) </> objectDir </> keyPath key (hashDirLower def)
data AccessMethod = AccessDirect | AccessShell
diff --git a/Remote/Hook.hs b/Remote/Hook.hs
index ce7781cfb..31b5ab7c5 100644
--- a/Remote/Hook.hs
+++ b/Remote/Hook.hs
@@ -7,8 +7,6 @@
module Remote.Hook (remote) where
-import qualified Data.Map as M
-
import Common.Annex
import Types.Remote
import Types.Key
@@ -20,6 +18,9 @@ import Annex.UUID
import Remote.Helper.Special
import Utility.Env
+import Data.Default
+import qualified Data.Map as M
+
type Action = String
type HookName = String
@@ -90,7 +91,7 @@ hookEnv action k f = Just <$> mergeenv (fileenv f ++ keyenv)
]
fileenv Nothing = []
fileenv (Just file) = [envvar "FILE" file]
- hashbits = map takeDirectory $ splitPath $ hashDirMixed k
+ hashbits = map takeDirectory $ splitPath $ hashDirMixed def k
lookupHook :: HookName -> Action -> Annex (Maybe String)
lookupHook hookname action = do
diff --git a/Remote/Rsync.hs b/Remote/Rsync.hs
index ae6f5450e..527bfb80a 100644
--- a/Remote/Rsync.hs
+++ b/Remote/Rsync.hs
@@ -38,6 +38,7 @@ import Logs.Transfer
import Types.Creds
import Types.Key (isChunkKey)
+import Data.Default
import qualified Data.Map as M
remote :: RemoteType
@@ -212,7 +213,7 @@ remove o k = do
- content could be. Note that the parent directories have
- to also be explicitly included, due to how rsync
- traverses directories. -}
- includes = concatMap use annexHashes
+ includes = concatMap use (annexHashes def)
use h = let dir = h k in
[ parentDir dir
, dir
diff --git a/Remote/Rsync/RsyncUrl.hs b/Remote/Rsync/RsyncUrl.hs
index 7ebd2f68d..5493e4e90 100644
--- a/Remote/Rsync/RsyncUrl.hs
+++ b/Remote/Rsync/RsyncUrl.hs
@@ -14,6 +14,7 @@ import Locations
import Utility.Rsync
import Utility.SafeCommand
+import Data.Default
import System.FilePath.Posix
#ifdef mingw32_HOST_OS
import Data.String.Utils
@@ -35,7 +36,7 @@ rsyncEscape o u
| otherwise = u
rsyncUrls :: RsyncOpts -> Key -> [RsyncUrl]
-rsyncUrls o k = map use annexHashes
+rsyncUrls o k = map use (annexHashes def)
where
use h = rsyncUrl o </> hash h </> rsyncEscape o (f </> f)
f = keyFile k
diff --git a/Remote/WebDAV/DavLocation.hs b/Remote/WebDAV/DavLocation.hs
index b5d374943..157e7151a 100644
--- a/Remote/WebDAV/DavLocation.hs
+++ b/Remote/WebDAV/DavLocation.hs
@@ -17,6 +17,7 @@ import Utility.Url (URLString)
import System.FilePath.Posix -- for manipulating url paths
import Network.Protocol.HTTP.DAV (inDAVLocation, DAVT)
import Control.Monad.IO.Class (MonadIO)
+import Data.Default
#ifdef mingw32_HOST_OS
import Data.String.Utils
#endif
@@ -33,9 +34,9 @@ keyDir :: Key -> DavLocation
keyDir k = addTrailingPathSeparator $ hashdir </> keyFile k
where
#ifndef mingw32_HOST_OS
- hashdir = hashDirLower k
+ hashdir = hashDirLower def k
#else
- hashdir = replace "\\" "/" (hashDirLower k)
+ hashdir = replace "\\" "/" (hashDirLower def k)
#endif
keyLocation :: Key -> DavLocation