diff options
author | Joey Hess <joeyh@joeyh.name> | 2018-06-04 14:31:55 -0400 |
---|---|---|
committer | Joey Hess <joeyh@joeyh.name> | 2018-06-04 15:30:26 -0400 |
commit | 67e46229a51b980cb523c37acea1e160c57a13c6 (patch) | |
tree | dac9baef1d02f5fc5b87f4efce92ffc0c4ae3172 /Remote/Helper | |
parent | dc5550a54e21bd0d8bcc899620076eafdd8a1e46 (diff) |
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
Diffstat (limited to 'Remote/Helper')
-rw-r--r-- | Remote/Helper/Git.hs | 3 | ||||
-rw-r--r-- | Remote/Helper/Ssh.hs | 12 |
2 files changed, 9 insertions, 6 deletions
diff --git a/Remote/Helper/Git.hs b/Remote/Helper/Git.hs index 5c611e46ab..12348f7a52 100644 --- a/Remote/Helper/Git.hs +++ b/Remote/Helper/Git.hs @@ -42,7 +42,8 @@ gitRepoInfo r = do let lastsynctime = case mtimes of [] -> "never" _ -> show $ posixSecondsToUTCTime $ realToFrac $ maximum mtimes + repo <- Remote.getRepo r return - [ ("repository location", Git.repoLocation (Remote.repo r)) + [ ("repository location", Git.repoLocation repo) , ("last synced", lastsynctime) ] diff --git a/Remote/Helper/Ssh.hs b/Remote/Helper/Ssh.hs index 3ceb41edf7..2c5e204ef2 100644 --- a/Remote/Helper/Ssh.hs +++ b/Remote/Helper/Ssh.hs @@ -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 |