summaryrefslogtreecommitdiff
path: root/Backend.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2011-05-18 19:34:46 -0400
committerGravatar Joey Hess <joey@kitenet.net>2011-05-18 19:34:46 -0400
commitcd8354187273ee07c8953bea72df2d60b8b50c5d (patch)
treee8b2306baa392c1cb0f399a413d3fd0ce85872de /Backend.hs
parentdd44e53c0ca3e5eec78f03a3a222b4922d6d097c (diff)
--backend now overrides any backend configured in .gitattributes files.
Diffstat (limited to 'Backend.hs')
-rw-r--r--Backend.hs15
1 files changed, 11 insertions, 4 deletions
diff --git a/Backend.hs b/Backend.hs
index 6140664ce..ab15974c8 100644
--- a/Backend.hs
+++ b/Backend.hs
@@ -33,6 +33,7 @@ module Backend (
) where
import Control.Monad.State (liftIO, when)
+import Control.Monad (liftM)
import System.IO.Error (try)
import System.FilePath
import System.Posix.Files
@@ -56,7 +57,7 @@ list = do
then return l
else do
s <- getstandard
- d <- Annex.getState Annex.defaultbackend
+ d <- Annex.getState Annex.forcebackend
handle d s
where
parseBackendList l [] = l
@@ -161,9 +162,15 @@ lookupFile file = do
chooseBackends :: [FilePath] -> Annex [(FilePath, Maybe (Backend Annex))]
chooseBackends fs = do
g <- Annex.gitRepo
- bs <- Annex.getState Annex.supportedBackends
- pairs <- liftIO $ Git.checkAttr g "annex.backend" fs
- return $ map (\(f,b) -> (f, maybeLookupBackendName bs b)) pairs
+ forced <- Annex.getState Annex.forcebackend
+ if forced /= Nothing
+ then do
+ l <- list
+ return $ map (\f -> (f, Just $ head l)) fs
+ else do
+ bs <- Annex.getState Annex.supportedBackends
+ pairs <- liftIO $ Git.checkAttr g "annex.backend" fs
+ return $ map (\(f,b) -> (f, maybeLookupBackendName bs b)) pairs
{- Returns the backend to use for a key. -}
keyBackend :: Key -> Annex (Backend Annex)