initremote --private

This commit is contained in:
Joey Hess 2021-04-23 14:47:46 -04:00
parent 141a4e9750
commit 2b264b3edf
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
2 changed files with 12 additions and 1 deletions

View file

@ -1,5 +1,9 @@
git-annex (8.20210331) UNRELEASED; urgency=medium
* New annex.private and remote.name.annex-private configs that can
prevent storing information about a repository and remotes in the
git-annex branch.
* initremote: Added --private option to set up a private special remote.
* Fix build with persistent-2.12.0.1
* Avoid excess commits to the git-annex branch when stall detection is
enabled.

View file

@ -1,6 +1,6 @@
{- git-annex command
-
- Copyright 2011-2020 Joey Hess <id@joeyh.name>
- Copyright 2011-2021 Joey Hess <id@joeyh.name>
-
- Licensed under the GNU AGPL version 3 or higher.
-}
@ -34,6 +34,7 @@ data InitRemoteOptions = InitRemoteOptions
{ cmdparams :: CmdParams
, sameas :: Maybe (DeferredParse UUID)
, whatElse :: Bool
, privateRemote :: Bool
}
optParser :: CmdParamsDesc -> Parser InitRemoteOptions
@ -45,6 +46,10 @@ optParser desc = InitRemoteOptions
<> short 'w'
<> help "describe other configuration parameters for a special remote"
)
<*> switch
( long "private"
<> help "keep special remote information out of git-annex branch"
)
parseSameasOption :: Parser (DeferredParse UUID)
parseSameasOption = parseUUIDOption <$> strOption
@ -85,6 +90,8 @@ start o (name:ws) = ifM (isJust <$> findExisting name)
perform :: RemoteType -> String -> R.RemoteConfig -> InitRemoteOptions -> CommandPerform
perform t name c o = do
when (privateRemote o) $
setConfig (remoteAnnexConfig c "private") (boolConfig True)
dummycfg <- liftIO dummyRemoteGitConfig
let c' = M.delete uuidField c
(c'', u) <- R.setup t R.Init (sameasu <|> uuidfromuser) Nothing c' dummycfg