summaryrefslogtreecommitdiff
path: root/Annex/Branch.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joeyh@joeyh.name>2015-01-27 17:38:06 -0400
committerGravatar Joey Hess <joeyh@joeyh.name>2015-01-27 17:38:06 -0400
commitdf81023501e2b0d930ec90cc6f5a6c6735f84818 (patch)
tree5bd3b9d8f91464bd27c9d86f700b975a76067147 /Annex/Branch.hs
parent1e07d61b9669f85a02551d7858177bd33ffaea6f (diff)
Repository tuning parameters can now be passed when initializing a repository for the first time.
* init: Repository tuning parameters can now be passed when initializing a repository for the first time. For details, see http://git-annex.branchable.com/tuning/ * merge: Refuse to merge changes from a git-annex branch of a repo that has been tuned in incompatable ways.
Diffstat (limited to 'Annex/Branch.hs')
-rw-r--r--Annex/Branch.hs11
1 files changed, 11 insertions, 0 deletions
diff --git a/Annex/Branch.hs b/Annex/Branch.hs
index 2191ec263..c67270312 100644
--- a/Annex/Branch.hs
+++ b/Annex/Branch.hs
@@ -49,9 +49,11 @@ import Annex.Perms
import Logs
import Logs.Transitions
import Logs.Trust.Pure
+import Logs.Difference.Pure
import Annex.ReplaceFile
import qualified Annex.Queue
import Annex.Branch.Transitions
+import qualified Annex
{- Name of the branch that is used to store git-annex's information. -}
name :: Git.Ref
@@ -160,6 +162,7 @@ updateTo pairs = do
<$> getLocal transitionsLog
unless (null branches) $ do
showSideAction merge_desc
+ mapM_ checkBranchDifferences refs
mergeIndex jl refs
let commitrefs = nub $ fullname:refs
unlessM (handleTransitions jl localtransitions commitrefs) $ do
@@ -537,3 +540,11 @@ performTransitionsLocked jl ts neednewlocalbranch transitionedrefs = do
apply rest hasher file content' trustmap
PreserveFile ->
apply rest hasher file content trustmap
+
+checkBranchDifferences :: Git.Ref -> Annex ()
+checkBranchDifferences ref = do
+ theirdiffs <- allDifferences . parseDifferencesLog . decodeBS
+ <$> catFile ref differenceLog
+ mydiffs <- annexDifferences <$> Annex.getGitConfig
+ when (theirdiffs /= mydiffs) $
+ error "Remote repository is tuned in incompatable way; cannot be merged with local repository."