summaryrefslogtreecommitdiff
path: root/Annex
diff options
context:
space:
mode:
authorGravatar Joey Hess <joeyh@joeyh.name>2017-02-27 16:08:16 -0400
committerGravatar Joey Hess <joeyh@joeyh.name>2017-02-27 16:08:23 -0400
commit025b8102e5741f437e970eb29593ced31b0554e4 (patch)
tree9c6d4376dfd3740c4c0f902bae6015278b23d0b0 /Annex
parentacaaf842b5afbf3e6d0c0095cbe15699ab2419d3 (diff)
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.
Diffstat (limited to 'Annex')
-rw-r--r--Annex/Init.hs13
1 files changed, 12 insertions, 1 deletions
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 <id@joeyh.name>
+ - Copyright 2011-2017 Joey Hess <id@joeyh.name>
-
- 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"