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.
This commit is contained in:
Joey Hess 2018-02-07 15:02:12 -04:00
parent 9a35831ac3
commit d884e5b6fe
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
4 changed files with 63 additions and 34 deletions

View file

@ -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