set remote's annexUrl automatically

When the remote repository's git config file
has annex.url set to an annex+http url.
This commit is contained in:
Joey Hess 2024-07-28 20:13:41 -04:00
parent c87cfe1e00
commit bc9cc79e85
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
5 changed files with 35 additions and 21 deletions

View file

@ -340,6 +340,12 @@ tryGitConfigRead autoinit r hasuuid
-- optimisation.
unless (fromMaybe False $ Git.Config.isBare r') $
setremote setRemoteBare False
-- When annex.url is set to a P2P http url,
-- store in remote.name.annexUrl
case Git.fromConfigValue <$> Git.Config.getMaybe (annexConfig "url") r' of
Just u | isP2PHttpProtocolUrl u ->
setremote (setConfig . annexUrlConfigKey) u
_ -> noop
return r'
Left err -> do
set_ignore "not usable by git-annex" False