summaryrefslogtreecommitdiff
path: root/Annex/AdjustedBranch.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joeyh@joeyh.name>2016-06-13 14:18:22 -0400
committerGravatar Joey Hess <joeyh@joeyh.name>2016-06-13 14:18:22 -0400
commite45dc368733dbce902e35f0e77ce20e687f98280 (patch)
treec88657c2576947a3f03687cc67c7536a029d0bcf /Annex/AdjustedBranch.hs
parent45279bc31bad704223c1c552e811186411b7c651 (diff)
v6: Fix bad merge in an adjusted branch that resulted in an empty tree.
Diffstat (limited to 'Annex/AdjustedBranch.hs')
-rw-r--r--Annex/AdjustedBranch.hs12
1 files changed, 9 insertions, 3 deletions
diff --git a/Annex/AdjustedBranch.hs b/Annex/AdjustedBranch.hs
index 5fcb74149..ae5ad9a51 100644
--- a/Annex/AdjustedBranch.hs
+++ b/Annex/AdjustedBranch.hs
@@ -358,10 +358,16 @@ updateAdjustedBranch tomerge (origbranch, adj) mergeconfig commitmode = catchBoo
withTmpDirIn misctmpdir "git" $ \tmpgit -> withWorkTreeRelated tmpgit $
withemptydir tmpwt $ withWorkTree tmpwt $ do
liftIO $ writeFile (tmpgit </> "HEAD") (fromRef updatedorig)
+ -- This reset makes git merge not care
+ -- that the work tree is empty; otherwise
+ -- it will think that all the files have
+ -- been staged for deletion, and sometimes
+ -- the merge includes these deletions
+ -- (for an unknown reason).
+ -- http://thread.gmane.org/gmane.comp.version-control.git/297237
+ inRepo $ Git.Command.run [Param "reset", Param "HEAD", Param "--quiet"]
showAction $ "Merging into " ++ fromRef (Git.Ref.base origbranch)
- -- The --no-ff is important; it makes git
- -- merge not care that the work tree is empty.
- merged <- inRepo (Git.Merge.merge' [Param "--no-ff"] tomerge mergeconfig commitmode)
+ merged <- inRepo (Git.Merge.merge' [] tomerge mergeconfig commitmode)
<||> (resolveMerge (Just updatedorig) tomerge True <&&> commitResolvedMerge commitmode)
if merged
then do