starting support for remote.name.annexUrl set to annex+http

In this case, Remote.Git should not use that url for all access to
the repository. It will only be used for annex operations, which isn't
done yet.
This commit is contained in:
Joey Hess 2024-07-23 09:12:21 -04:00
parent fdb888a56a
commit 5c39652235
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
5 changed files with 30 additions and 8 deletions

View file

@ -58,6 +58,7 @@ import qualified Remote.GitLFS
import qualified Remote.P2P
import qualified Remote.Helper.P2P as P2PHelper
import P2P.Address
import P2P.Http.Url
import Annex.Path
import Creds
import Types.NumCopies
@ -107,10 +108,12 @@ list autoinit = do
tweakurl c r = do
let n = fromJust $ Git.remoteName r
case M.lookup (annexurl r) c of
Nothing -> return r
Just url -> inRepo $ \g ->
Git.Construct.remoteNamed n $
Git.Construct.fromRemoteLocation (Git.fromConfigValue url) False g
Just url | not (isP2PHttpProtocolUrl (Git.fromConfigValue url)) ->
inRepo $ \g -> Git.Construct.remoteNamed n $
Git.Construct.fromRemoteLocation
(Git.fromConfigValue url)
False g
_ -> return r
isGitRemoteAnnex :: Git.Repo -> Bool
isGitRemoteAnnex r = "annex::" `isPrefixOf` Git.repoLocation r