external protocol VERSION 2

Support VERSION 2 in the external special remote protocol, which is
identical to VERSION 1, but avoids external remote programs neededing to
work around the above bug. External remote program that support
exporttree=yes are recommended to be updated to send VERSION 2.

Sponsored-by: Kevin Mueller on Patreon
This commit is contained in:
Joey Hess 2023-03-28 17:00:08 -04:00
parent 82c65b7951
commit 18d326cb6f
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
11 changed files with 80 additions and 73 deletions

View file

@ -39,7 +39,7 @@ empty, but the separating spaces are still required in that case.
The special remote is responsible for sending the first message, indicating
the version of the protocol it is using.
VERSION 1
VERSION 2
Recent versions of git-annex respond with a message indicating
protocol extensions that it supports. Older versions of
@ -271,7 +271,7 @@ These messages may be sent by the special remote at any time that it's
handling a request.
* `VERSION Int`
Supported protocol version. Current version is 1. Must be sent first
Supported protocol version. Current version is 2. Must be sent first
thing at startup, as until it sees this git-annex does not know how to
talk with the special remote program!
(git-annex does not send a reply to this message, but may give up if it
@ -428,6 +428,18 @@ remote.
git-annex will not talk to it any further. If the program receives
an ERROR from git-annex, it can exit with its own ERROR.
## protocol versions
Currently git-annex supports `VERSION 1` and `VERSION 2`.
The two protocol versions are actually identical.
Old versions of git-annex that supported only `VERSION 1`
had a bug in their implementation of the
part of the protocol documented in the[[export_and_import_appendix]].
The bug could result in ontent being exported to the wrong file.
External special remotes that implement that should use `VERSION 2` to
avoid talking to the buggy old version of git-annex.
## extensions
These protocol extensions are currently supported.

View file

@ -37,7 +37,10 @@ a request, it can reply with `UNSUPPORTED-REQUEST`.
`REMOVEEXPORTDIRECTORY`), specifying the name of the exported file. It
will be in the form of a relative path, and may contain path separators,
whitespace, and other special characters.
No response is made to this message.
No response is made to this message.
Note that old versions of git-annex had a bug that sometimes prevented
sending `EXPORT`. To avoid being used with such a buggy version of
git-annex, send `VERSION 2`.
* `TRANSFEREXPORT STORE|RETRIEVE Key File`
Requests the transfer of a File on local disk to or from the previously
provided `EXPORT` Name on the special remote.