ensure merge directory is empty before starting merge

Don't want some past failed merge to lead to bad results, potentially.
This commit is contained in:
Joey Hess 2013-10-16 14:57:58 -04:00
parent e227e8f683
commit 78acbfeb6a

View file

@ -122,6 +122,8 @@ addDirect file cache = do
-}
mergeDirect :: FilePath -> Git.Ref -> Git.Repo -> IO Bool
mergeDirect d branch g = do
whenM (doesDirectoryExist d) $
removeDirectoryRecursive d
createDirectoryIfMissing True d
let g' = g { location = Local { gitdir = Git.localGitDir g, worktree = Just d } }
Git.Merge.mergeNonInteractive branch g'