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.
This commit is contained in:
Joey Hess 2017-02-27 16:08:16 -04:00
parent 6e0e7d885c
commit e53070c1ff
No known key found for this signature in database
GPG key ID: C910D9222512E3C7
7 changed files with 51 additions and 10 deletions

View file

@ -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"