git-remote-annex enableremote to support readonly webdav

* Allow enableremote of an existing webdav special remote that has
  read-only access.
* git-remote-annex: Use enableremote rather than initremote.
This commit is contained in:
Joey Hess 2025-01-07 15:57:20 -04:00
parent e7e479c1f0
commit 5d2aaafa6c
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
5 changed files with 39 additions and 9 deletions

View file

@ -586,14 +586,15 @@ withSpecialRemote cfg@(SpecialRemoteConfig {}) sab a = case specialRemoteName cf
Nothing -> specialRemoteFromUrl sab inittempremote
where
-- Initialize a new special remote with the provided configuration
-- and name.
-- and name. This actually does a Remote.Enable, because the
-- special remote has already been initialized somewhere before.
initremote remotename = do
let c = M.insert SpecialRemote.nameField (Proposed remotename) $
M.delete (Accepted "config-uuid") $
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.Enable c) (Just (specialRemoteUUID cfg))
Nothing c dummycfg
`onException` cleanupremote remotename
Logs.Remote.configSet u c'