summaryrefslogtreecommitdiff
path: root/Annex
diff options
context:
space:
mode:
Diffstat (limited to 'Annex')
-rw-r--r--Annex/AdjustedBranch.hs14
-rw-r--r--Annex/AutoMerge.hs6
-rw-r--r--Annex/Direct.hs1
3 files changed, 13 insertions, 8 deletions
diff --git a/Annex/AdjustedBranch.hs b/Annex/AdjustedBranch.hs
index a30dda809..994444626 100644
--- a/Annex/AdjustedBranch.hs
+++ b/Annex/AdjustedBranch.hs
@@ -32,6 +32,7 @@ import qualified Git.Ref
import qualified Git.Command
import qualified Git.Tree
import qualified Git.DiffTree
+import qualified Git.Merge
import Git.Tree (TreeItem(..))
import Git.Sha
import Git.Env
@@ -272,13 +273,16 @@ updateAdjustedBranch tomerge (origbranch, adj) commitmode = catchBoolIO $
withemptydir tmpwt $ withWorkTree tmpwt $ do
liftIO $ writeFile (tmpgit </> "HEAD") (fromRef updatedorig)
showAction $ "Merging into " ++ fromRef (Git.Ref.base origbranch)
- ifM (autoMergeFrom tomerge (Just origbranch) True commitmode)
- ( do
+ -- The --no-ff is important; it makes git
+ -- merge not care that the work tree is empty.
+ merged <- inRepo (Git.Merge.mergeNonInteractive' [Param "--no-ff"] tomerge commitmode)
+ <||> (resolveMerge (Just updatedorig) tomerge True <&&> commitResolvedMerge commitmode)
+ if merged
+ then do
!mergecommit <- liftIO $ extractSha <$> readFile (tmpgit </> "HEAD")
-- This is run after the commit lock is dropped.
return $ postmerge currbranch mergecommit
- , return $ return False
- )
+ else return $ return False
changestomerge Nothing _ = return $ return False
withemptydir d a = bracketIO setup cleanup (const a)
@@ -305,7 +309,7 @@ updateAdjustedBranch tomerge (origbranch, adj) commitmode = catchBoolIO $
adjmergecommit <- commitAdjustedTree' adjtree mergecommit
[mergecommit, currbranch]
showAction "Merging into adjusted branch"
- ifM (autoMergeFrom adjmergecommit (Just currbranch) False commitmode)
+ ifM (autoMergeFrom adjmergecommit (Just currbranch) commitmode)
-- The adjusted branch has a merge commit on top;
-- clean that up and propigate any changes made
-- in that merge to the origbranch.
diff --git a/Annex/AutoMerge.hs b/Annex/AutoMerge.hs
index e1662f81a..074e955d7 100644
--- a/Annex/AutoMerge.hs
+++ b/Annex/AutoMerge.hs
@@ -42,8 +42,8 @@ import qualified Data.ByteString.Lazy as L
- Callers should use Git.Branch.changed first, to make sure that
- there are changes from the current branch to the branch being merged in.
-}
-autoMergeFrom :: Git.Ref -> Maybe Git.Ref -> Bool -> Git.Branch.CommitMode -> Annex Bool
-autoMergeFrom branch currbranch inoverlay commitmode = do
+autoMergeFrom :: Git.Ref -> Maybe Git.Ref -> Git.Branch.CommitMode -> Annex Bool
+autoMergeFrom branch currbranch commitmode = do
showOutput
case currbranch of
Nothing -> go Nothing
@@ -52,7 +52,7 @@ autoMergeFrom branch currbranch inoverlay commitmode = do
go old = ifM isDirect
( mergeDirect currbranch old branch (resolveMerge old branch False) commitmode
, inRepo (Git.Merge.mergeNonInteractive branch commitmode)
- <||> (resolveMerge old branch inoverlay <&&> commitResolvedMerge commitmode)
+ <||> (resolveMerge old branch False <&&> commitResolvedMerge commitmode)
)
{- Resolves a conflicted merge. It's important that any conflicts be
diff --git a/Annex/Direct.hs b/Annex/Direct.hs
index cd0835f04..782803e71 100644
--- a/Annex/Direct.hs
+++ b/Annex/Direct.hs
@@ -204,6 +204,7 @@ stageMerge d branch commitmode = do
-- has been updated, which would leave things in an inconsistent
-- state if mergeDirectCleanup is interrupted.
-- <http://marc.info/?l=git&m=140262402204212&w=2>
+ liftIO $ print ("stagemerge in", d)
merger <- ifM (coreSymlinks <$> Annex.getGitConfig)
( return Git.Merge.stageMerge
, return $ \ref -> Git.Merge.mergeNonInteractive ref commitmode