diff options
author | Joey Hess <joeyh@joeyh.name> | 2018-02-07 15:02:12 -0400 |
---|---|---|
committer | Joey Hess <joeyh@joeyh.name> | 2018-02-07 15:02:12 -0400 |
commit | 404646a2c7997bcaf76f6b881556c55f13ed58d1 (patch) | |
tree | eb1c3c6b5f4b58f8147615eea2effb46819d31c4 /Remote/External.hs | |
parent | 759c89dbdb2af41b1026dd1be8da1748ba4cd091 (diff) |
Added EXTENSIONS to external special remote protocol.
Allows using new special remote messages when git-annex supports them,
and avoiding using them when git-annex is too old. The new INFO is one
such message.
There's also the possibility, currently unused, for the special remote's
reply to include some kind of extensions of its own.
Merging this is blocked by https://github.com/datalad/datalad/issues/2124
since it seems it will break datalad. I checked all the other special
remotes and they will be ok.
This commit was supported by the NSF-funded DataLad project.
Diffstat (limited to 'Remote/External.hs')
-rw-r--r-- | Remote/External.hs | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/Remote/External.hs b/Remote/External.hs index 5a1e7f210..bff74c3b1 100644 --- a/Remote/External.hs +++ b/Remote/External.hs @@ -505,7 +505,8 @@ withExternalState external = bracket alloc dealloc dealloc st = liftIO $ atomically $ modifyTVar' v (st:) -{- Starts an external remote process running, and checks VERSION. -} +{- Starts an external remote process running, and checks VERSION and + - exchanges EXTENSIONS. -} startExternal :: External -> Annex ExternalState startExternal external = do errrelayer <- mkStderrRelayer @@ -514,6 +515,18 @@ startExternal external = do (const Nothing) (checkVersion st external) (const Nothing) + sendMessage st external (EXTENSIONS supportedExtensionList) + -- It responds with a EXTENSIONS_RESPONSE; that extensions list + -- is reserved for future expansion. UNSUPPORTED_REQUEST is also + -- accepted. + receiveMessage st external + (\resp -> case resp of + EXTENSIONS_RESPONSE _ -> Just (return ()) + UNSUPPORTED_REQUEST -> Just (return ()) + _ -> Nothing + ) + (const Nothing) + (const Nothing) return st where start errrelayer g = liftIO $ do |