stub Remote.P2P

Similar to GCrypt remotes, P2P remotes have an url, so Remote.Git has to
separate them out and handle them, passing off to Remote.P2P.

This commit was sponsored by Ignacio on Patreon.
This commit is contained in:
Joey Hess 2016-12-06 12:19:47 -04:00
parent a8c868c2e1
commit b29088b8dc
No known key found for this signature in database
GPG key ID: C910D9222512E3C7
5 changed files with 99 additions and 2 deletions

View file

@ -49,6 +49,8 @@ import Remote.Helper.Git
import Remote.Helper.Messages
import qualified Remote.Helper.Ssh as Ssh
import qualified Remote.GCrypt
import qualified Remote.P2P
import P2P.Address
import Annex.Path
import Creds
import Annex.CatFile
@ -130,7 +132,9 @@ configRead autoinit r = do
gen :: Git.Repo -> UUID -> RemoteConfig -> RemoteGitConfig -> Annex (Maybe Remote)
gen r u c gc
| Git.GCrypt.isEncrypted r = Remote.GCrypt.chainGen r u c gc
| otherwise = go <$> remoteCost gc defcst
| otherwise = case repoP2PAddress r of
Nothing -> go <$> remoteCost gc defcst
Just addr -> Remote.P2P.chainGen addr r u c gc
where
defcst = if repoCheap r then cheapRemoteCost else expensiveRemoteCost
go cst = Just new