enableremote: Allow type= to be provided when it does not change the type of the special remote
Fixes breakage in datalad test suite https://github.com/datalad/datalad/issues/7747 Also, revert the change I earlier made to git-annex's own test suite due to the same problem.
This commit is contained in:
parent
555377e625
commit
c20b8610b6
3 changed files with 13 additions and 9 deletions
|
@ -2,6 +2,8 @@ git-annex (10.20250926) UNRELEASED; urgency=medium
|
||||||
|
|
||||||
* Remove the Servant build flag; always build with support for
|
* Remove the Servant build flag; always build with support for
|
||||||
annex+http urls and git-annex p2phttp.
|
annex+http urls and git-annex p2phttp.
|
||||||
|
* enableremote: Allow type= to be provided when it does not change the
|
||||||
|
type of the special remote.
|
||||||
|
|
||||||
-- Joey Hess <id@joeyh.name> Thu, 25 Sep 2025 13:36:21 -0400
|
-- Joey Hess <id@joeyh.name> Thu, 25 Sep 2025 13:36:21 -0400
|
||||||
|
|
||||||
|
|
|
@ -59,11 +59,9 @@ start _ [] = unknownNameError "Specify the remote to enable."
|
||||||
start o (name:rest) = go =<< filter matchingname <$> Annex.getGitRemotes
|
start o (name:rest) = go =<< filter matchingname <$> Annex.getGitRemotes
|
||||||
where
|
where
|
||||||
matchingname r = Git.remoteName r == Just name
|
matchingname r = Git.remoteName r == Just name
|
||||||
go [] = deadLast name $
|
go [] = deadLast name $
|
||||||
let config = Logs.Remote.keyValToConfig Proposed rest
|
startSpecialRemote o name $
|
||||||
in case M.lookup SpecialRemote.typeField config of
|
Logs.Remote.keyValToConfig Proposed rest
|
||||||
Nothing -> startSpecialRemote o name config
|
|
||||||
Just _ -> giveup "Cannot change type= of existing special remote. Instead, use: git-annex initremote --sameas"
|
|
||||||
go (r:_)
|
go (r:_)
|
||||||
| not (null rest) = go []
|
| not (null rest) = go []
|
||||||
| otherwise = do
|
| otherwise = do
|
||||||
|
@ -105,6 +103,10 @@ startSpecialRemote' cname perform name config ((u, c, mcu):[]) =
|
||||||
starting cname ai si $ do
|
starting cname ai si $ do
|
||||||
let fullconfig = config `M.union` c
|
let fullconfig = config `M.union` c
|
||||||
t <- either giveup return (SpecialRemote.findType fullconfig)
|
t <- either giveup return (SpecialRemote.findType fullconfig)
|
||||||
|
case SpecialRemote.findType c of
|
||||||
|
Right t' | t' /= t ->
|
||||||
|
giveup "Cannot change type= of existing special remote. Instead, use: git-annex initremote --sameas"
|
||||||
|
_ -> noop
|
||||||
gc <- maybe (liftIO dummyRemoteGitConfig)
|
gc <- maybe (liftIO dummyRemoteGitConfig)
|
||||||
(return . Remote.gitconfig)
|
(return . Remote.gitconfig)
|
||||||
=<< Remote.byUUID u
|
=<< Remote.byUUID u
|
||||||
|
|
8
Test.hs
8
Test.hs
|
@ -1918,19 +1918,19 @@ test_gpg_crypto = do
|
||||||
where
|
where
|
||||||
testscheme scheme = intmpclonerepo $ test_with_gpg $ \gpgcmd environ -> do
|
testscheme scheme = intmpclonerepo $ test_with_gpg $ \gpgcmd environ -> do
|
||||||
createDirectory (literalOsPath "dir")
|
createDirectory (literalOsPath "dir")
|
||||||
let ps =
|
let initps =
|
||||||
[ "foo"
|
[ "foo"
|
||||||
|
, "type=directory"
|
||||||
, "encryption=" ++ scheme
|
, "encryption=" ++ scheme
|
||||||
, "directory=dir"
|
, "directory=dir"
|
||||||
, "highRandomQuality=false"
|
, "highRandomQuality=false"
|
||||||
] ++ if scheme `elem` ["hybrid","pubkey"]
|
] ++ if scheme `elem` ["hybrid","pubkey"]
|
||||||
then ["keyid=" ++ Utility.Gpg.testKeyId]
|
then ["keyid=" ++ Utility.Gpg.testKeyId]
|
||||||
else []
|
else []
|
||||||
let initps = ps ++ [ "type=directory" ]
|
|
||||||
git_annex' "initremote" initps (Just environ) "initremote"
|
git_annex' "initremote" initps (Just environ) "initremote"
|
||||||
git_annex_shouldfail' "initremote" initps (Just environ) "initremote should not work when run twice in a row"
|
git_annex_shouldfail' "initremote" initps (Just environ) "initremote should not work when run twice in a row"
|
||||||
git_annex' "enableremote" ps (Just environ) "enableremote"
|
git_annex' "enableremote" initps (Just environ) "enableremote"
|
||||||
git_annex' "enableremote" ps (Just environ) "enableremote when run twice in a row"
|
git_annex' "enableremote" initps (Just environ) "enableremote when run twice in a row"
|
||||||
git_annex' "get" [annexedfile] (Just environ) "get of file"
|
git_annex' "get" [annexedfile] (Just environ) "get of file"
|
||||||
annexed_present annexedfile
|
annexed_present annexedfile
|
||||||
git_annex' "copy" [annexedfile, "--to", "foo"] (Just environ) "copy --to encrypted remote"
|
git_annex' "copy" [annexedfile, "--to", "foo"] (Just environ) "copy --to encrypted remote"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue