aboutsummaryrefslogtreecommitdiff
path: root/Git/Branch.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2013-11-05 18:20:52 -0400
committerGravatar Joey Hess <joey@kitenet.net>2013-11-05 18:20:52 -0400
commit638a0190aa2797970151988fa26fe128d1804c9c (patch)
tree6c4058e87897019973c1e68b0681a5017ac0a71a /Git/Branch.hs
parent4f6c8222072ace33e3acedddd31637089ae474b6 (diff)
factor out update
Diffstat (limited to 'Git/Branch.hs')
-rw-r--r--Git/Branch.hs10
1 files changed, 9 insertions, 1 deletions
diff --git a/Git/Branch.hs b/Git/Branch.hs
index 01d028f55..7b560246e 100644
--- a/Git/Branch.hs
+++ b/Git/Branch.hs
@@ -97,7 +97,7 @@ commit message branch parentrefs repo = do
sha <- getSha "commit-tree" $ pipeWriteRead
(map Param $ ["commit-tree", show tree] ++ ps)
(Just $ flip hPutStr message) repo
- run [Param "update-ref", Param $ show branch, Param $ show sha] repo
+ update branch sha repo
return sha
where
ps = concatMap (\r -> ["-p", show r]) parentrefs
@@ -105,3 +105,11 @@ commit message branch parentrefs repo = do
{- A leading + makes git-push force pushing a branch. -}
forcePush :: String -> String
forcePush b = "+" ++ b
+
+{- Updates a branch (or other ref) to a new Sha. -}
+update :: Branch -> Sha -> Repo -> IO ()
+update branch sha = run
+ [ Param "update-ref"
+ , Param $ show branch
+ , Param $ show sha
+ ]