From 025b8102e5741f437e970eb29593ced31b0554e4 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Mon, 27 Feb 2017 16:08:16 -0400 Subject: inheritable annex.securehashesonly * init: When annex.securehashesonly has been set with git-annex config, copy that value to the annex.securehashesonly git config. * config --set: As well as setting value in git-annex branch, set local gitconfig. This is needed especially for annex.securehashesonly, which is read only from local gitconfig and not the git-annex branch. doc/todo/sha1_collision_embedding_in_git-annex_keys.mdwn has the rationalle for doing it this way. There's no perfect solution; this seems to be the least-bad one. This commit was supported by the NSF-funded DataLad project. --- Annex/Init.hs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'Annex') diff --git a/Annex/Init.hs b/Annex/Init.hs index 3427c0049..53fbe35f2 100644 --- a/Annex/Init.hs +++ b/Annex/Init.hs @@ -1,6 +1,6 @@ {- git-annex repository initialization - - - Copyright 2011-2016 Joey Hess + - Copyright 2011-2017 Joey Hess - - Licensed under the GNU GPL version 3 or higher. -} @@ -26,6 +26,7 @@ import qualified Git.Objects import qualified Annex.Branch import Logs.UUID import Logs.Trust.Basic +import Logs.Config import Types.TrustLevel import Annex.Version import Annex.Difference @@ -110,6 +111,7 @@ initialize' mversion = do , unlessM isBareRepo switchHEADBack ) + propigateSecureHashesOnly createInodeSentinalFile False uninitialize :: Annex () @@ -257,3 +259,12 @@ initSharedClone True = do u <- getUUID trustSet u UnTrusted setConfig (annexConfig "hardlink") (Git.Config.boolConfig True) + +{- Propigate annex.securehashesonly from then global config to local + - config. This makes a clone inherit a parent's setting, but once + - a repository has a local setting, changes to the global config won't + - affect it. -} +propigateSecureHashesOnly :: Annex () +propigateSecureHashesOnly = + maybe noop (setConfig (ConfigKey "annex.securehashesonly")) + =<< getGlobalConfig "annex.securehashesonly" -- cgit v1.2.3