diff options
author | Joey Hess <joey@kitenet.net> | 2011-06-30 13:32:47 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2011-06-30 13:32:47 -0400 |
commit | 896726cde425f6c74273b35cde30c1909551ff66 (patch) | |
tree | 39f5c3f7636b53af79625866d845e50897d8fd1c /Git.hs | |
parent | f0497312a77d59f24c8273245ac324b02bb1eb13 (diff) |
rename GitUnionMerge to Git.UnionMerge
Also, moved commit function into Git proper, it's not union merge specific.
Diffstat (limited to 'Git.hs')
-rw-r--r-- | Git.hs | 14 |
1 files changed, 14 insertions, 0 deletions
@@ -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] |