diff options
author | Joey Hess <joey@kitenet.net> | 2011-09-15 16:57:02 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2011-09-15 16:59:52 -0400 |
commit | 5ff04bf2afcc62d1762adbc1c2a0374952328c0f (patch) | |
tree | a2d6bfac942582573d71ffe394f1c867688f8024 /Backend.hs | |
parent | 35145202d2e463569989b710ab5b87f6d9a8fdc1 (diff) |
tweak
Diffstat (limited to 'Backend.hs')
-rw-r--r-- | Backend.hs | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/Backend.hs b/Backend.hs index 75327de80..0c9ea8d0b 100644 --- a/Backend.hs +++ b/Backend.hs @@ -6,6 +6,7 @@ -} module Backend ( + BackendFile, list, orderedList, genKey, @@ -101,20 +102,22 @@ lookupFile file = do skip = "skipping " ++ file ++ " (unknown backend " ++ bname ++ ")" +type BackendFile = (Maybe (Backend Annex), FilePath) + {- Looks up the backends that should be used for each file in a list. - That can be configured on a per-file basis in the gitattributes file. -} -chooseBackends :: [FilePath] -> Annex [(FilePath, Maybe (Backend Annex))] +chooseBackends :: [FilePath] -> Annex [BackendFile] chooseBackends fs = do g <- Annex.gitRepo forced <- Annex.getState Annex.forcebackend if forced /= Nothing then do l <- orderedList - return $ map (\f -> (f, Just $ head l)) fs + return $ map (\f -> (Just $ head l, f)) fs else do pairs <- liftIO $ Git.checkAttr g "annex.backend" fs - return $ map (\(f,b) -> (f, maybeLookupBackendName b)) pairs + return $ map (\(f,b) -> (maybeLookupBackendName b, f)) pairs {- Looks up a backend by name. May fail if unknown. -} lookupBackendName :: String -> Backend Annex |