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:
parent
552b000ef1
commit
ddf05c271b
2 changed files with 9 additions and 10 deletions
|
@ -22,6 +22,7 @@ import qualified Git.Remote.Remove
|
||||||
import qualified Annex.SpecialRemote as SpecialRemote
|
import qualified Annex.SpecialRemote as SpecialRemote
|
||||||
import qualified Annex.Branch
|
import qualified Annex.Branch
|
||||||
import qualified Types.Remote as Remote
|
import qualified Types.Remote as Remote
|
||||||
|
import qualified Logs.Remote
|
||||||
import Annex.Transfer
|
import Annex.Transfer
|
||||||
import Backend.GitRemoteAnnex
|
import Backend.GitRemoteAnnex
|
||||||
import Config
|
import Config
|
||||||
|
@ -481,20 +482,15 @@ withSpecialRemote cfg@(SpecialRemoteConfig {}) sab a = case specialRemoteName cf
|
||||||
where
|
where
|
||||||
-- Initialize a new special remote with the provided configuration
|
-- Initialize a new special remote with the provided configuration
|
||||||
-- and name.
|
-- 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
|
initremote remotename = do
|
||||||
let c = M.insert SpecialRemote.nameField (Proposed remotename)
|
let c = M.insert SpecialRemote.nameField (Proposed remotename)
|
||||||
(specialRemoteConfig cfg)
|
(specialRemoteConfig cfg)
|
||||||
t <- either giveup return (SpecialRemote.findType c)
|
t <- either giveup return (SpecialRemote.findType c)
|
||||||
dummycfg <- liftIO dummyRemoteGitConfig
|
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
|
Nothing c dummycfg
|
||||||
`onException` cleanupremote remotename
|
`onException` cleanupremote remotename
|
||||||
|
Logs.Remote.configSet u c'
|
||||||
setConfig (remoteConfig c' "url") (specialRemoteUrl cfg)
|
setConfig (remoteConfig c' "url") (specialRemoteUrl cfg)
|
||||||
remotesChanged
|
remotesChanged
|
||||||
getEnabledSpecialRemoteByName remotename >>= \case
|
getEnabledSpecialRemoteByName remotename >>= \case
|
||||||
|
|
|
@ -14,9 +14,6 @@ This is implememented and working. Remaining todo list for it:
|
||||||
|
|
||||||
* Test incremental pushes that don't fast-forward.
|
* Test incremental pushes that don't fast-forward.
|
||||||
|
|
||||||
* exporttree=yes remote works, but cloning one from the annex:: url
|
|
||||||
does not, somehow exportTree is not set then.
|
|
||||||
|
|
||||||
* Support max-bundles config
|
* Support max-bundles config
|
||||||
|
|
||||||
* Need to mention git-remote-annex in special remotes page, and perhaps
|
* Need to mention git-remote-annex in special remotes page, and perhaps
|
||||||
|
@ -91,6 +88,12 @@ This is implememented and working. Remaining todo list for it:
|
||||||
This should be fixable by making git-remote-annex not write to the
|
This should be fixable by making git-remote-annex not write to the
|
||||||
git-annex branch, but to eg, a temporary journal directory.
|
git-annex branch, but to eg, a temporary journal directory.
|
||||||
|
|
||||||
|
Also, cloning currently writes the special remote config into remote.log,
|
||||||
|
which might be slightly different in some way than the config in
|
||||||
|
remote.log for the same remote. cloning should not change the stored
|
||||||
|
config of a remote, but that branch write was necessary. So throwing
|
||||||
|
away the branch write is also good for this case.
|
||||||
|
|
||||||
Also, when the remote uses importree=yes, pushing to it updates
|
Also, when the remote uses importree=yes, pushing to it updates
|
||||||
content identifiers, which currently get recorded in the git-annex
|
content identifiers, which currently get recorded in the git-annex
|
||||||
branch. It would be good to avoid that being written as well.
|
branch. It would be good to avoid that being written as well.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue