From 2b264b3edf786f5a7a7cd3a612955b22698e5574 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Fri, 23 Apr 2021 14:47:46 -0400 Subject: [PATCH] initremote --private --- CHANGELOG | 4 ++++ Command/InitRemote.hs | 9 ++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/CHANGELOG b/CHANGELOG index f2315ec2f5..dfd9e19ead 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -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. diff --git a/Command/InitRemote.hs b/Command/InitRemote.hs index 51972cc318..ece7456089 100644 --- a/Command/InitRemote.hs +++ b/Command/InitRemote.hs @@ -1,6 +1,6 @@ {- git-annex command - - - Copyright 2011-2020 Joey Hess + - Copyright 2011-2021 Joey Hess - - 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