diff options
author | Joey Hess <joey@kitenet.net> | 2010-10-14 20:05:04 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2010-10-14 20:05:04 -0400 |
commit | 4c3ad80f320d3c4cccc3e41e4f2364155bae22a1 (patch) | |
tree | 5c09b65168929801291f2d5f84250a88e53d5394 /Backend.hs | |
parent | b8ba60428a0b4c077482560757e830e9ba02a823 (diff) |
bugfix
Diffstat (limited to 'Backend.hs')
-rw-r--r-- | Backend.hs | 20 |
1 files changed, 7 insertions, 13 deletions
diff --git a/Backend.hs b/Backend.hs index 47e42b822..f419831d2 100644 --- a/Backend.hs +++ b/Backend.hs @@ -78,17 +78,9 @@ retrieveKeyFile backend key dest = (B.retrieveKeyFile backend) key dest removeKey :: Backend -> Key -> Annex Bool removeKey backend key = (B.removeKey backend) key -{- Checks if any backend has a key. -} +{- Checks if a backend has its key. -} hasKey :: Key -> Annex Bool -hasKey key = do - b <- backendList - hasKey' b key -hasKey' [] key = return False -hasKey' (b:bs) key = do - has <- (B.hasKey b) key - if (has) - then return True - else hasKey' bs key +hasKey key = (B.hasKey (lookupBackendName $ backendName key)) key {- Looks up the key and backend corresponding to an annexed file, - by examining what the file symlinks to. -} @@ -101,6 +93,8 @@ lookupFile file = do where lookup = do l <- readSymbolicLink file - return $ Just (k l, b l) - k l = fileKey $ takeFileName $ l - b l = lookupBackendName $ takeFileName $ parentDir $ l + return $ Just $ pair $ takeFileName l + pair file = (k, b) + where + k = fileKey file + b = lookupBackendName $ backendName k |