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:
parent
e7e479c1f0
commit
5d2aaafa6c
5 changed files with 39 additions and 9 deletions
|
@ -6,6 +6,9 @@ git-annex (10.20250103) UNRELEASED; urgency=medium
|
||||||
* Avoid verification error when addurl --verifiable is used
|
* Avoid verification error when addurl --verifiable is used
|
||||||
with an url claimed by a special remote other than the web.
|
with an url claimed by a special remote other than the web.
|
||||||
* Fix installation on Android.
|
* Fix installation on Android.
|
||||||
|
* Allow enableremote of an existing webdav special remote that has
|
||||||
|
read-only access.
|
||||||
|
* git-remote-annex: Use enableremote rather than initremote.
|
||||||
|
|
||||||
-- Joey Hess <id@joeyh.name> Fri, 03 Jan 2025 14:30:38 -0400
|
-- Joey Hess <id@joeyh.name> Fri, 03 Jan 2025 14:30:38 -0400
|
||||||
|
|
||||||
|
|
|
@ -586,14 +586,15 @@ withSpecialRemote cfg@(SpecialRemoteConfig {}) sab a = case specialRemoteName cf
|
||||||
Nothing -> specialRemoteFromUrl sab inittempremote
|
Nothing -> specialRemoteFromUrl sab inittempremote
|
||||||
where
|
where
|
||||||
-- Initialize a new special remote with the provided configuration
|
-- 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
|
initremote remotename = do
|
||||||
let c = M.insert SpecialRemote.nameField (Proposed remotename) $
|
let c = M.insert SpecialRemote.nameField (Proposed remotename) $
|
||||||
M.delete (Accepted "config-uuid") $
|
M.delete (Accepted "config-uuid") $
|
||||||
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.Enable c) (Just (specialRemoteUUID cfg))
|
||||||
Nothing c dummycfg
|
Nothing c dummycfg
|
||||||
`onException` cleanupremote remotename
|
`onException` cleanupremote remotename
|
||||||
Logs.Remote.configSet u c'
|
Logs.Remote.configSet u c'
|
||||||
|
|
|
@ -137,7 +137,9 @@ webdavSetup ss mu mcreds c gc = do
|
||||||
(c', encsetup) <- encryptionSetup c gc
|
(c', encsetup) <- encryptionSetup c gc
|
||||||
pc <- either giveup return . parseRemoteConfig c' =<< configParser remote c'
|
pc <- either giveup return . parseRemoteConfig c' =<< configParser remote c'
|
||||||
creds <- maybe (getCreds pc gc u) (return . Just) mcreds
|
creds <- maybe (getCreds pc gc u) (return . Just) mcreds
|
||||||
testDav url creds
|
case ss of
|
||||||
|
Init -> testDav url creds
|
||||||
|
_ -> noop
|
||||||
gitConfigSpecialRemote u c' [("webdav", "true")]
|
gitConfigSpecialRemote u c' [("webdav", "true")]
|
||||||
c'' <- setRemoteCredPair ss encsetup pc gc (davCreds u) creds
|
c'' <- setRemoteCredPair ss encsetup pc gc (davCreds u) creds
|
||||||
return (c'', u)
|
return (c'', u)
|
||||||
|
|
|
@ -1,10 +1,9 @@
|
||||||
[[!comment format=mdwn
|
[[!comment format=mdwn
|
||||||
username="joey"
|
username="joey"
|
||||||
subject="""comment 24"""
|
subject="""Re: read-only webdav access"""
|
||||||
date="2023-06-20T17:25:27Z"
|
date="2025-01-07T18:51:26Z"
|
||||||
content="""
|
content="""
|
||||||
httpalso now supports chunking. So I think there's no need to add readonly
|
Update: Since I posted this comment, enableremote of an existing webdav
|
||||||
support to webdav, probably. But if you disagree, I do think it would be
|
special remote has been made to work even if you cannot write to it. So
|
||||||
possible to add. Just probably not useful.. after all webdav minus writing
|
there is no need to use httpalso and no need for a readonly=true.
|
||||||
is little different than http. If you disagree, open a [[todo]].
|
|
||||||
"""]]
|
"""]]
|
||||||
|
|
|
@ -0,0 +1,25 @@
|
||||||
|
[[!comment format=mdwn
|
||||||
|
username="joey"
|
||||||
|
subject="""comment 1"""
|
||||||
|
date="2025-01-07T18:51:26Z"
|
||||||
|
content="""
|
||||||
|
I'm not sure I'd trust an old comment of mine to reflect whether httpalso
|
||||||
|
supports http authentication. From what I can see, without trying it, it
|
||||||
|
will use git-credential to prompt for password when receiving a 401
|
||||||
|
response, the same as all other parts of git-annex that download urls
|
||||||
|
do nowadays.
|
||||||
|
|
||||||
|
Re git-remote-annex, I see your point though. Since it does set up the
|
||||||
|
remote when cloning, and webdav remote setup calls involves creating and
|
||||||
|
deleting a test file, the user needs write access currently. (Whether that
|
||||||
|
test file is worth it doing at all, I'm on the fence about. It seemed like
|
||||||
|
a good idea way back when.)
|
||||||
|
|
||||||
|
I think that, rather than needing readonly=true, enableremote of a webdav
|
||||||
|
special remote should just assume it exists and not test write access to
|
||||||
|
it. Then it will work with readonly access. I've implemented that.
|
||||||
|
|
||||||
|
And I've made git-remote-annex on git clone do an enableremote, rather than
|
||||||
|
an initremote. That should make it work with a readonly webdav special
|
||||||
|
remote.
|
||||||
|
"""]]
|
Loading…
Add table
Add a link
Reference in a new issue