summaryrefslogtreecommitdiff
path: root/Git/Branch.hs
diff options
context:
space:
mode:
authorJoey Hess <joey@kitenet.net>2012-12-13 00:24:19 -0400
committerJoey Hess <joey@kitenet.net>2012-12-13 00:24:19 -0400
commitf87a781aa69f6853208778434b1e293d21095f51 (patch)
tree0bb5cb36ab213deed5ee5ca7eb42574c7a23bd79 /Git/Branch.hs
parentb77290cecc9929ccd41d6dbceefa6783e71ecd2c (diff)
finished where indentation changes
Diffstat (limited to 'Git/Branch.hs')
-rw-r--r--Git/Branch.hs58
1 files changed, 29 insertions, 29 deletions
diff --git a/Git/Branch.hs b/Git/Branch.hs
index 3407845d1b..736c4c6e85 100644
--- a/Git/Branch.hs
+++ b/Git/Branch.hs
@@ -36,10 +36,10 @@ current r = do
currentUnsafe :: Repo -> IO (Maybe Git.Ref)
currentUnsafe r = parse . firstLine
<$> pipeReadStrict [Param "symbolic-ref", Param "HEAD"] r
- where
- parse l
- | null l = Nothing
- | otherwise = Just $ Git.Ref l
+ where
+ parse l
+ | null l = Nothing
+ | otherwise = Just $ Git.Ref l
{- Checks if the second branch has any commits not present on the first
- branch. -}
@@ -47,12 +47,12 @@ changed :: Branch -> Branch -> Repo -> IO Bool
changed origbranch newbranch repo
| origbranch == newbranch = return False
| otherwise = not . null <$> diffs
- where
- diffs = pipeReadStrict
- [ Param "log"
- , Param (show origbranch ++ ".." ++ show newbranch)
- , Params "--oneline -n1"
- ] repo
+ where
+ diffs = pipeReadStrict
+ [ Param "log"
+ , Param (show origbranch ++ ".." ++ show newbranch)
+ , Params "--oneline -n1"
+ ] repo
{- Given a set of refs that are all known to have commits not
- on the branch, tries to update the branch by a fast-forward.
@@ -70,23 +70,23 @@ fastForward branch (first:rest) repo =
( no_ff
, maybe no_ff do_ff =<< findbest first rest
)
- where
- no_ff = return False
- do_ff to = do
- run "update-ref"
- [Param $ show branch, Param $ show to] repo
- return True
- findbest c [] = return $ Just c
- findbest c (r:rs)
- | c == r = findbest c rs
- | otherwise = do
- better <- changed c r repo
- worse <- changed r c repo
- case (better, worse) of
- (True, True) -> return Nothing -- divergent fail
- (True, False) -> findbest r rs -- better
- (False, True) -> findbest c rs -- worse
- (False, False) -> findbest c rs -- same
+ where
+ no_ff = return False
+ do_ff to = do
+ run "update-ref"
+ [Param $ show branch, Param $ show to] repo
+ return True
+ findbest c [] = return $ Just c
+ findbest c (r:rs)
+ | c == r = findbest c rs
+ | otherwise = do
+ better <- changed c r repo
+ worse <- changed r c repo
+ case (better, worse) of
+ (True, True) -> return Nothing -- divergent fail
+ (True, False) -> findbest r rs -- better
+ (False, True) -> findbest c rs -- worse
+ (False, False) -> findbest c rs -- same
{- Commits the index into the specified branch (or other ref),
- with the specified parent refs, and returns the committed sha -}
@@ -99,5 +99,5 @@ commit message branch parentrefs repo = do
message repo
run "update-ref" [Param $ show branch, Param $ show sha] repo
return sha
- where
- ps = concatMap (\r -> ["-p", show r]) parentrefs
+ where
+ ps = concatMap (\r -> ["-p", show r]) parentrefs