summaryrefslogtreecommitdiff
path: root/Git.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2011-12-12 18:23:24 -0400
committerGravatar Joey Hess <joey@kitenet.net>2011-12-12 18:30:33 -0400
commit543d0d250104c1f5908e1b7b258d36d95488a029 (patch)
tree7342d994ac8932ed92b1e14108fdc6bb8e84d84e /Git.hs
parentda95cbadca5b7ef3058b91a384d5f3a48cc39039 (diff)
split out Git/Ref.hs
Diffstat (limited to 'Git.hs')
-rw-r--r--Git.hs17
1 files changed, 4 insertions, 13 deletions
diff --git a/Git.hs b/Git.hs
index 1da5997c1..9af68a194 100644
--- a/Git.hs
+++ b/Git.hs
@@ -24,7 +24,6 @@ module Git (
repoIsHttp,
repoIsLocalBare,
repoDescribe,
- refDescribe,
repoLocation,
workTree,
workTreeFile,
@@ -178,14 +177,6 @@ repoDescribe Repo { location = Url url } = show url
repoDescribe Repo { location = Dir dir } = dir
repoDescribe Repo { location = Unknown } = "UNKNOWN"
-{- Converts a fully qualified git ref into a user-visible version. -}
-refDescribe :: Ref -> String
-refDescribe = remove "refs/heads/" . remove "refs/remotes/" . show
- where
- remove prefix s
- | prefix `isPrefixOf` s = drop (length prefix) s
- | otherwise = s
-
{- Location of the repo, either as a path or url. -}
repoLocation :: Repo -> String
repoLocation Repo { location = Url url } = show url
@@ -463,16 +454,16 @@ shaSize :: Int
shaSize = 40
{- Commits the index into the specified branch (or other ref),
- - with the specified parent refs, and returns the new ref -}
-commit :: String -> Ref -> [Ref] -> Repo -> IO Ref
-commit message newref parentrefs repo = do
+ - with the specified parent refs, and returns the committed sha -}
+commit :: String -> Branch -> [Ref] -> Repo -> IO Sha
+commit message branch parentrefs repo = do
tree <- getSha "write-tree" $ asString $
pipeRead [Param "write-tree"] repo
sha <- getSha "commit-tree" $ asString $
ignorehandle $ pipeWriteRead
(map Param $ ["commit-tree", show tree] ++ ps)
(L.pack message) repo
- run "update-ref" [Param $ show newref, Param $ show sha] repo
+ run "update-ref" [Param $ show branch, Param $ show sha] repo
return sha
where
ignorehandle a = snd <$> a