d6711800ad
It was possible for a interrupted sync or merge in direct mode to leave the work tree out of sync with the last recorded commit. This would result in the next commit seeing files missing from the work tree, and committing their removal. Now, a direct mode merge happens not only in a throwaway work tree, but using a temporary index file, and without any commits or index changes being made until the real work tree has been updated. If the merge is interrupted, the work tree may have some updated files, but worst case a commit will redundantly commit changes that come from the merge. This commit was sponsored by Tony Cantor.
33 lines
820 B
Haskell
33 lines
820 B
Haskell
{- git merging
|
|
-
|
|
- Copyright 2012, 2014 Joey Hess <joey@kitenet.net>
|
|
-
|
|
- Licensed under the GNU GPL version 3 or higher.
|
|
-}
|
|
|
|
module Git.Merge where
|
|
|
|
import Common
|
|
import Git
|
|
import Git.Command
|
|
import Git.BuildVersion
|
|
|
|
{- Avoids recent git's interactive merge. -}
|
|
mergeNonInteractive :: Ref -> Repo -> IO Bool
|
|
mergeNonInteractive branch
|
|
| older "1.7.7.6" = merge [Param $ fromRef branch]
|
|
| otherwise = merge [Param "--no-edit", Param $ fromRef branch]
|
|
where
|
|
merge ps = runBool $ Param "merge" : ps
|
|
|
|
{- Stage the merge into the index, but do not commit it.-}
|
|
stageMerge :: Ref -> Repo -> IO Bool
|
|
stageMerge branch = runBool
|
|
[ Param "merge"
|
|
, Param "--quiet"
|
|
, Param "--no-commit"
|
|
-- Without this, a fast-forward merge is done, since it involves no
|
|
-- commit.
|
|
, Param "--no-ff"
|
|
, Param $ fromRef branch
|
|
]
|