change Remote.repo to Remote.getRepo

This is groundwork for letting a repo be instantiated the first time
it's actually used, instead of at startup.

The only behavior change is that some old special cases for xmpp remotes
were removed. Where before git-annex silently did nothing with those
no-longer supported remotes, it may now fail in some way.

The additional IO action should have no performance impact as long as
it's simply return.

This commit was sponsored by Boyd Stephen Smith Jr. on Patreon
This commit is contained in:
Joey Hess 2018-06-04 14:31:55 -04:00
parent dc5550a54e
commit 67e46229a5
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
36 changed files with 266 additions and 191 deletions

View file

@ -135,7 +135,8 @@ rsyncParamsRemote unlocked r direction key file (AssociatedFile afile) = do
-- compatability.
: (Fields.direct, if unlocked then "1" else "")
: maybe [] (\f -> [(Fields.associatedFile, f)]) afile
Just (shellcmd, shellparams) <- git_annex_shell ConsumeStdin (repo r)
repo <- getRepo r
Just (shellcmd, shellparams) <- git_annex_shell ConsumeStdin repo
(if direction == Download then "sendkey" else "recvkey")
[ Param $ key2file key ]
fields
@ -237,13 +238,14 @@ openP2PSshConnection :: Remote -> P2PSshConnectionPool -> Annex (Maybe P2PSshCon
openP2PSshConnection r connpool = do
u <- getUUID
let ps = [Param (fromUUID u)]
git_annex_shell ConsumeStdin (repo r) "p2pstdio" ps [] >>= \case
repo <- getRepo r
git_annex_shell ConsumeStdin repo "p2pstdio" ps [] >>= \case
Nothing -> do
liftIO $ rememberunsupported
return Nothing
Just (cmd, params) -> start cmd params
Just (cmd, params) -> start cmd params =<< getRepo r
where
start cmd params = liftIO $ withNullHandle $ \nullh -> do
start cmd params repo = liftIO $ withNullHandle $ \nullh -> do
-- stderr is discarded because old versions of git-annex
-- shell always error
(Just from, Just to, Nothing, pid) <- createProcess $
@ -253,7 +255,7 @@ openP2PSshConnection r connpool = do
, std_err = UseHandle nullh
}
let conn = P2P.P2PConnection
{ P2P.connRepo = repo r
{ P2P.connRepo = repo
, P2P.connCheckAuth = const False
, P2P.connIhdl = to
, P2P.connOhdl = from