proxying to local git remotes works

This just happened to work correctly. Rather surprisingly. It turns out
that openP2PSshConnection actually also supports local git remotes,
by just running git-annex-shell with the path to the remote.

Renamed "P2PSsh" to "P2PShell" to make this clear.
This commit is contained in:
Joey Hess 2024-06-12 10:10:11 -04:00
parent 178da0dc99
commit c6e0710281
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
4 changed files with 62 additions and 56 deletions

View file

@ -15,7 +15,7 @@ import qualified P2P.Protocol as P2P
import qualified Annex
import Annex.UUID
import qualified CmdLine.GitAnnexShell.Checks as Checks
import Remote.Helper.Ssh (openP2PSshConnection', closeP2PSshConnection)
import Remote.Helper.Ssh (openP2PShellConnection', closeP2PShellConnection)
import System.IO.Error
@ -72,12 +72,12 @@ performProxy clientuuid servermode remote = do
othermsg protoerrhandler
withclientversion _ Nothing = done
-- FIXME: Support special remotes and non-ssh git remotes.
-- FIXME: Support special remotes.
connectremote clientmaxversion cont =
openP2PSshConnection' remote clientmaxversion >>= \case
openP2PShellConnection' remote clientmaxversion >>= \case
Just conn@(P2P.IO.OpenConnection (remoterunst, remoteconn, _)) ->
cont (RemoteSide remoterunst remoteconn)
`finally` liftIO (closeP2PSshConnection conn)
`finally` liftIO (closeP2PShellConnection conn)
_ -> giveup "Unable to connect to remote."
protoerrhandler cont a = a >>= \case