init: Added --no-autoenable option

Someone may disagree with what repositories are set to autoenable and
it's good to have local overrides.

See https://github.com/datalad/datalad/issues/6634

Sponsored-by: Dartmouth College's Datalad project
This commit is contained in:
Joey Hess 2022-06-01 13:27:49 -04:00
parent cac752d720
commit 0d50c90794
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
3 changed files with 18 additions and 2 deletions

View file

@ -1,3 +1,9 @@
git-annex (10.20220526) UNRELEASED; urgency=medium
* init: Added --no-autoenable option.
-- Joey Hess <id@joeyh.name> Wed, 01 Jun 2022 13:23:05 -0400
git-annex (10.20220525) upstream; urgency=medium
* Special remotes with importtree=yes or exporttree=yes are once again

View file

@ -25,6 +25,7 @@ data InitOptions = InitOptions
{ initDesc :: String
, initVersion :: Maybe RepoVersion
, autoEnableOnly :: Bool
, noAutoEnable :: Bool
}
optParser :: CmdParamsDesc -> Parser InitOptions
@ -38,6 +39,10 @@ optParser desc = InitOptions
( long "autoenable"
<> help "only enable special remotes configured with autoenable=true"
)
<*> switch
( long "no-autoenable"
<> help "do not enable special remotes configured with autoenable=true"
)
parseRepoVersion :: MonadFail m => String -> m RepoVersion
parseRepoVersion s = case RepoVersion <$> readish s of
@ -73,7 +78,8 @@ perform os = do
initialize False
(if null (initDesc os) then Nothing else Just (initDesc os))
(initVersion os)
Annex.SpecialRemote.autoEnable
unless (noAutoEnable os)
Annex.SpecialRemote.autoEnable
next $ return True
performAutoEnableOnly :: CommandPerform

View file

@ -48,11 +48,15 @@ to the user who tries to run git-annex init.
When the version given is not supported, but can be automatically
upgraded to a newer version, it will use the newer version instead.
* --autoenable
* `--autoenable`
Only enable any special remotes that were configured with
autoenable=true, do not otherwise initialize anything.
* `--no-autoenable`
Do not enable special remotes that were configured with autoenable=true.
* Also the [[git-annex-common-options]](1) can be used.
# SEE ALSO