rename GitUnionMerge to Git.UnionMerge

Also, moved commit function into Git proper, it's not union merge specific.
This commit is contained in:
Joey Hess 2011-06-30 13:32:47 -04:00
parent f0497312a7
commit 896726cde4
4 changed files with 40 additions and 42 deletions

14
Git.hs
View file

@ -56,6 +56,7 @@ module Git (
hashObject,
getSha,
shaSize,
commit,
prop_idempotent_deencode
) where
@ -425,6 +426,19 @@ getSha subcommand a = do
shaSize :: Int
shaSize = 40
{- Commits the index into the specified branch,
- with the specified parent refs. -}
commit :: Repo -> String -> String -> [String] -> IO ()
commit g message newref parentrefs = do
tree <- getSha "write-tree" $
pipeRead g [Param "write-tree"]
sha <- getSha "commit-tree" $ ignorehandle $
pipeWriteRead g (map Param $ ["commit-tree", tree] ++ ps) message
run g "update-ref" [Param newref, Param sha]
where
ignorehandle a = return . snd =<< a
ps = concatMap (\r -> ["-p", r]) parentrefs
{- Reads null terminated output of a git command (as enabled by the -z
- parameter), and splits it into a list of files/lines/whatever. -}
pipeNullSplit :: Repo -> [CommandParam] -> IO [FilePath]