summaryrefslogtreecommitdiff
path: root/Annex/AutoMerge.hs
diff options
context:
space:
mode:
authorJoey Hess <joey@kitenet.net>2014-06-09 20:32:11 -0400
committerJoey Hess <joey@kitenet.net>2014-06-09 20:32:11 -0400
commitf08fcb50304da22891e884ebc387848c1363efc2 (patch)
tree856720c20f043c8ca8755d00094576cba205f4b9 /Annex/AutoMerge.hs
parent03f186609fbd3850669f8061ff63b0985f3089bf (diff)
simplify
Diffstat (limited to 'Annex/AutoMerge.hs')
-rw-r--r--Annex/AutoMerge.hs25
1 files changed, 13 insertions, 12 deletions
diff --git a/Annex/AutoMerge.hs b/Annex/AutoMerge.hs
index 22d3332dd5..71b28c1d44 100644
--- a/Annex/AutoMerge.hs
+++ b/Annex/AutoMerge.hs
@@ -39,7 +39,7 @@ autoMergeFrom branch currbranch = do
go old = ifM isDirect
( mergeDirect currbranch old branch (resolveMerge old branch)
, inRepo (Git.Merge.mergeNonInteractive branch)
- <||> resolveMerge old branch
+ <||> (resolveMerge old branch <&&> commitResolvedMerge)
)
{- Resolves a conflicted merge. It's important that any conflicts be
@@ -64,11 +64,11 @@ autoMergeFrom branch currbranch = do
-
- In indirect mode, the merge is resolved in the work tree and files
- staged, to clean up from a conflicted merge that was run in the work
- - tree. The resolution is committed.
+ - tree.
-
- - In direct mode, the work tree is not touched here, and no commit is made;
- - files are staged to the index, and written to the gitAnnexMergeDir, and
- - later mergeDirectCleanup handles updating the work tree.
+ - In direct mode, the work tree is not touched here; files are staged to
+ - the index, and written to the gitAnnexMergeDir, for later handling by
+ - the direct mode merge code.
-}
resolveMerge :: Maybe Git.Ref -> Git.Ref -> Annex Bool
resolveMerge us them = do
@@ -88,13 +88,6 @@ resolveMerge us them = do
unlessM isDirect $
cleanConflictCruft mergedfs top
Annex.Queue.flush
- unlessM isDirect $ do
- void $ inRepo $ Git.Command.runBool
- [ Param "commit"
- , Param "--no-verify"
- , Param "-m"
- , Param "git-annex automatic merge conflict fix"
- ]
showLongNote "Merge conflict was automatically resolved; you may want to examine the result."
return merged
@@ -172,3 +165,11 @@ cleanConflictCruft resolvedfs top = do
s = S.fromList resolvedfs
matchesresolved f = S.member (base f) s
base f = reverse $ drop 1 $ dropWhile (/= '~') $ reverse f
+
+commitResolvedMerge :: Annex Bool
+commitResolvedMerge = inRepo $ Git.Command.runBool
+ [ Param "commit"
+ , Param "--no-verify"
+ , Param "-m"
+ , Param "git-annex automatic merge conflict fix"
+ ]