summaryrefslogtreecommitdiff
path: root/Backend.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2010-11-15 18:04:19 -0400
committerGravatar Joey Hess <joey@kitenet.net>2010-11-15 18:04:19 -0400
commit748a7475bb99e1127dc12bb2cc9d5653e4648200 (patch)
tree1f8a191a561715b4ff22949e420b452380ab1f6e /Backend.hs
parent9dc43d25995b085745c16cc31ad11106a74a9973 (diff)
dropunused
Diffstat (limited to 'Backend.hs')
-rw-r--r--Backend.hs13
1 files changed, 10 insertions, 3 deletions
diff --git a/Backend.hs b/Backend.hs
index 14af56bbf..2f0f71d74 100644
--- a/Backend.hs
+++ b/Backend.hs
@@ -25,7 +25,8 @@ module Backend (
hasKey,
fsckKey,
lookupFile,
- chooseBackends
+ chooseBackends,
+ keyBackend
) where
import Control.Monad.State
@@ -111,8 +112,8 @@ removeKey backend key = (Internals.removeKey backend) key
{- Checks if a key is present in its backend. -}
hasKey :: Key -> Annex Bool
hasKey key = do
- bs <- Annex.supportedBackends
- (Internals.hasKey (lookupBackendName bs $ backendName key)) key
+ backend <- keyBackend key
+ (Internals.hasKey backend) key
{- Checks a key's backend for problems. -}
fsckKey :: Backend -> Key -> Annex Bool
@@ -154,3 +155,9 @@ chooseBackends fs = do
bs <- Annex.supportedBackends
pairs <- liftIO $ Git.checkAttr g "git-annex-backend" fs
return $ map (\(f,b) -> (f, maybeLookupBackendName bs b)) pairs
+
+{- Returns the backend to use for a key. -}
+keyBackend :: Key -> Annex Backend
+keyBackend key = do
+ bs <- Annex.supportedBackends
+ return $ lookupBackendName bs $ backendName key