diff options
Diffstat (limited to 'Remote/External.hs')
-rw-r--r-- | Remote/External.hs | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/Remote/External.hs b/Remote/External.hs index 6c36d879a..cd062e0c2 100644 --- a/Remote/External.hs +++ b/Remote/External.hs @@ -60,7 +60,7 @@ gen r u c gc = do , removeKey = removeKeyDummy , checkPresent = checkPresentDummy , checkPresentCheap = False - , whereisKey = Nothing + , whereisKey = Just $ whereis external , remoteFsck = Nothing , repairRepo = Nothing , config = c @@ -144,6 +144,13 @@ checkKey external k = either error id <$> go | k' == k -> Just $ return $ Left errmsg _ -> Nothing +whereis :: External -> Key -> Annex [String] +whereis external k = handleRequest external (WHEREIS k) Nothing $ \resp -> case resp of + WHEREIS_SUCCESS s -> Just $ return [s] + WHEREIS_FAILURE -> Just $ return [] + UNSUPPORTED_REQUEST -> Just $ return [] + _ -> Nothing + safely :: Annex Bool -> Annex Bool safely a = go =<< tryNonAsync a where |