summaryrefslogtreecommitdiff
path: root/Git
diff options
context:
space:
mode:
authorGravatar Joey Hess <joeyh@joeyh.name>2016-04-22 15:56:13 -0400
committerGravatar Joey Hess <joeyh@joeyh.name>2016-04-22 15:57:28 -0400
commitf9d8dd908fb60b83cb4bb40acae2a0cea87fa8c3 (patch)
treed022a7b4d700b727ae0ec251dc66072572bc0063 /Git
parent86e7c4d5330ebf96f82116d0a1738f765d21606d (diff)
use --allow-unrelated-histories for now
I'd prefer to use the env var, but let's use what git currently supports. Revert this when the env var gets supported. Note that the version checking assumes git 2.8.2 will get support for the switch.
Diffstat (limited to 'Git')
-rw-r--r--Git/Merge.hs30
1 files changed, 17 insertions, 13 deletions
diff --git a/Git/Merge.hs b/Git/Merge.hs
index c783521df..76ea35ddd 100644
--- a/Git/Merge.hs
+++ b/Git/Merge.hs
@@ -16,9 +16,9 @@ module Git.Merge (
import Common
import Git
import Git.Command
-import Git.BuildVersion
+import qualified Git.BuildVersion
+import qualified Git.Version
import Git.Branch (CommitMode(..))
-import Git.Env
data MergeConfig
= MergeNonInteractive
@@ -32,20 +32,30 @@ merge = merge' []
merge' :: [CommandParam] -> Ref -> [MergeConfig] -> CommitMode -> Repo -> IO Bool
merge' extraparams branch mergeconfig commitmode r
- | MergeNonInteractive `notElem` mergeconfig || older "1.7.7.6" =
+ | MergeNonInteractive `notElem` mergeconfig || Git.BuildVersion.older "1.7.7.6" =
go [Param $ fromRef branch]
| otherwise = go [Param "--no-edit", Param $ fromRef branch]
where
- go ps = runBool (sp ++ [Param "merge"] ++ ps ++ extraparams)
- =<< cfgRepo mergeconfig r
+ go ps = merge'' (sp ++ [Param "merge"] ++ ps ++ extraparams) mergeconfig r
sp
| commitmode == AutomaticCommit =
[Param "-c", Param "commit.gpgsign=false"]
| otherwise = []
+merge'' :: [CommandParam] -> [MergeConfig] -> Repo -> IO Bool
+merge'' ps mergeconfig r
+ | MergeUnrelatedHistories `elem` mergeconfig =
+ ifM (Git.Version.older "2.8.2")
+ ( go (ps ++ [Param "--allow-unrelated-histories"])
+ , go ps
+ )
+ | otherwise = go ps
+ where
+ go ps' = runBool ps' r
+
{- Stage the merge into the index, but do not commit it.-}
stageMerge :: Ref -> [MergeConfig] -> Repo -> IO Bool
-stageMerge branch mergeconfig r = runBool
+stageMerge branch = merge''
[ Param "merge"
, Param "--quiet"
, Param "--no-commit"
@@ -53,10 +63,4 @@ stageMerge branch mergeconfig r = runBool
-- commit.
, Param "--no-ff"
, Param $ fromRef branch
- ] =<< cfgRepo mergeconfig r
-
-cfgRepo :: [MergeConfig] -> Repo -> IO Repo
-cfgRepo mergeconfig r
- | MergeUnrelatedHistories `elem` mergeconfig =
- addGitEnv r "GIT_MERGE_ALLOW_UNRELATED_HISTORIES" "1"
- | otherwise = return r
+ ]