sync: Pass --allow-unrelated-histories to git merge when used with git git 2.9.0 or newer.

This makes merging a remote into a freshly created direct mode repository
work the same as it works in indirect mode.

The git-annex branches would get merged in any case by a sync,
since that doesn't use git merge.

This might need to be revisited later to better mirror git's behavior.
This commit is contained in:
Joey Hess 2016-11-15 18:26:17 -04:00
parent 6416ae9c09
commit 556b2ded2b
No known key found for this signature in database
GPG key ID: C910D9222512E3C7
4 changed files with 11 additions and 12 deletions

View file

@ -169,7 +169,12 @@ prepMerge :: Annex ()
prepMerge = Annex.changeDirectory =<< fromRepo Git.repoPath
mergeConfig :: [Git.Merge.MergeConfig]
mergeConfig = [Git.Merge.MergeNonInteractive]
mergeConfig =
[ Git.Merge.MergeNonInteractive
-- In several situations, unrelated histories should be merged
-- together. This includes pairing in the assistant etc.
, Git.Merge.MergeUnrelatedHistories
]
merge :: CurrBranch -> [Git.Merge.MergeConfig] -> Git.Branch.CommitMode -> Git.Branch -> Annex Bool
merge (Just b, Just adj) mergeconfig commitmode tomerge =