clone`.)
A single combined diff, containing all the changes, follows.
---- git-annex-10.20230126.orig/COPYRIGHT
-+++ git-annex-10.20230126/COPYRIGHT
+--- git-annex-10.20230407.orig/COPYRIGHT
++++ git-annex-10.20230407/COPYRIGHT
@@ -64,6 +64,10 @@ License: GPL-2
The full text of version 2 of the GPL is distributed in
/usr/share/common-licenses/GPL-2 on Debian systems.
License: BSD-2-clause
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
---- git-annex-10.20230126.orig/Remote/External.hs
-+++ git-annex-10.20230126/Remote/External.hs
-@@ -377,19 +377,27 @@ handleRequest external req mp responseha
- handleRequest' st external req mp responsehandler
-
- handleRequestKey :: External -> (SafeKey -> Request) -> Key -> Maybe MeterUpdate -> ResponseHandler a -> Annex a
--handleRequestKey external mkreq k mp responsehandler = case mkSafeKey k of
-- Right sk -> handleRequest external (mkreq sk) mp responsehandler
-+handleRequestKey external mkreq k mp responsehandler =
-+ withSafeKey k $ \sk -> handleRequest external (mkreq sk) mp responsehandler
-+
-+withSafeKey :: Key -> (SafeKey -> Annex a) -> Annex a
-+withSafeKey k a = case mkSafeKey k of
-+ Right sk -> a sk
- Left e -> giveup e
-
- {- Export location is first sent in an EXPORT message before
- - the main request. This is done because the ExportLocation can
- - contain spaces etc. -}
- handleRequestExport :: External -> ExportLocation -> (SafeKey -> Request) -> Key -> Maybe MeterUpdate -> ResponseHandler a -> Annex a
--handleRequestExport external loc mkreq k mp responsehandler = do
-- withExternalState external $ \st -> do
-- checkPrepared st external
-- sendMessage st (EXPORT loc)
-- handleRequestKey external mkreq k mp responsehandler
-+handleRequestExport external loc mkreq k mp responsehandler =
-+ withSafeKey k $ \sk ->
-+ -- Both the EXPORT and subsequent request must be sent to the
-+ -- same external process, so run both with the same external
-+ -- state.
-+ withExternalState external $ \st -> do
-+ checkPrepared st external
-+ sendMessage st (EXPORT loc)
-+ handleRequest' st external (mkreq sk) mp responsehandler
-
- handleRequest' :: ExternalState -> External -> Request -> Maybe MeterUpdate -> ResponseHandler a -> Annex a
- handleRequest' st external req mp responsehandler
---- git-annex-10.20230126.orig/Remote/External/Types.hs
-+++ git-annex-10.20230126/Remote/External/Types.hs
-@@ -415,7 +415,7 @@ newtype JobId = JobId Integer
- deriving (Eq, Ord, Show)
-
- supportedProtocolVersions :: [ProtocolVersion]
--supportedProtocolVersions = [1]
-+supportedProtocolVersions = [1, 2]
-
- instance Proto.Serializable JobId where
- serialize (JobId n) = show n
---- git-annex-10.20230126.orig/doc/design/external_special_remote_protocol.mdwn
-+++ git-annex-10.20230126/doc/design/external_special_remote_protocol.mdwn
-@@ -39,7 +39,7 @@ empty, but the separating spaces are sti
- 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 specia
- 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.
---- git-annex-10.20230126.orig/doc/special_remotes/external/example.sh
-+++ git-annex-10.20230126/doc/special_remotes/external/example.sh
-@@ -150,7 +150,7 @@ doremove () {
- }
-
- # This has to come first, to get the protocol started.
--echo VERSION 1
-+echo VERSION 2
-
- while read line; do
- set -- $line
---- git-annex-10.20230126.orig/doc/special_remotes/external/git-annex-remote-ipfs
-+++ git-annex-10.20230126/doc/special_remotes/external/git-annex-remote-ipfs
-@@ -54,7 +54,7 @@ getaddrs () {
- }
-
- # This has to come first, to get the protocol started.
--echo VERSION 1
-+echo VERSION 2
-
- while read line; do
- set -- $line
---- git-annex-10.20230126.orig/doc/special_remotes/external/git-annex-remote-torrent
-+++ git-annex-10.20230126/doc/special_remotes/external/git-annex-remote-torrent
-@@ -100,7 +100,7 @@ downloadtorrent () {
- }
-
- # This has to come first, to get the protocol started.
--echo VERSION 1
-+echo VERSION 2
-
- while read line; do
- set -- $line