fix cloning from an annex:: remote with exporttree=yes

Updating the remote list needs the config to be written to the git-annex
branch, which was not done for good reasons. While it would be possible
to instead use Remote.List.remoteGen without writing to the branch, I
already have a plan to discard git-annex branch writes made by
git-remote-annex, so the simplest fix is to write the config to the
branch.

Sponsored-by: k0ld on Patreon
This commit is contained in:
Joey Hess 2024-05-13 14:35:17 -04:00
parent 552b000ef1
commit ddf05c271b
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
2 changed files with 9 additions and 10 deletions

View file

@ -22,6 +22,7 @@ import qualified Git.Remote.Remove
import qualified Annex.SpecialRemote as SpecialRemote
import qualified Annex.Branch
import qualified Types.Remote as Remote
import qualified Logs.Remote
import Annex.Transfer
import Backend.GitRemoteAnnex
import Config
@ -481,20 +482,15 @@ withSpecialRemote cfg@(SpecialRemoteConfig {}) sab a = case specialRemoteName cf
where
-- Initialize a new special remote with the provided configuration
-- and name.
--
-- The configuration is not stored in the git-annex branch, because
-- it's expected that the git repository stored on the special
-- remote includes its configuration, perhaps under a different
-- name, and perhaps slightly different (when the annex:: url
-- omitted some unimportant part of the configuration).
initremote remotename = do
let c = M.insert SpecialRemote.nameField (Proposed remotename)
(specialRemoteConfig cfg)
t <- either giveup return (SpecialRemote.findType c)
dummycfg <- liftIO dummyRemoteGitConfig
(c', _u) <- Remote.setup t Remote.Init (Just (specialRemoteUUID cfg))
(c', u) <- Remote.setup t Remote.Init (Just (specialRemoteUUID cfg))
Nothing c dummycfg
`onException` cleanupremote remotename
Logs.Remote.configSet u c'
setConfig (remoteConfig c' "url") (specialRemoteUrl cfg)
remotesChanged
getEnabledSpecialRemoteByName remotename >>= \case