summaryrefslogtreecommitdiff
path: root/Annex/Quvi.hs
diff options
context:
space:
mode:
Diffstat (limited to 'Annex/Quvi.hs')
-rw-r--r--Annex/Quvi.hs17
1 files changed, 15 insertions, 2 deletions
diff --git a/Annex/Quvi.hs b/Annex/Quvi.hs
index b0725bae7..1a2edf6b8 100644
--- a/Annex/Quvi.hs
+++ b/Annex/Quvi.hs
@@ -14,7 +14,20 @@ import qualified Annex
import Utility.Quvi
import Utility.Url
-withQuviOptions :: forall a. Query a -> [CommandParam] -> URLString -> Annex a
+withQuviOptions :: forall a. Query a -> [QuviParam] -> URLString -> Annex a
withQuviOptions a ps url = do
+ v <- quviVersion
opts <- map Param . annexQuviOptions <$> Annex.getGitConfig
- liftIO $ a (ps++opts) url
+ liftIO $ a v (map (\mkp -> mkp v) ps++opts) url
+
+quviSupported :: URLString -> Annex Bool
+quviSupported u = liftIO . flip supported u =<< quviVersion
+
+quviVersion :: Annex QuviVersion
+quviVersion = go =<< Annex.getState Annex.quviversion
+ where
+ go (Just v) = return v
+ go Nothing = do
+ v <- liftIO probeVersion
+ Annex.changeState $ \s -> s { Annex.quviversion = Just v }
+ return v