aboutsummaryrefslogtreecommitdiff
path: root/Git/Branch.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joeyh@joeyh.name>2016-03-03 16:19:09 -0400
committerGravatar Joey Hess <joeyh@joeyh.name>2016-03-03 16:19:09 -0400
commitce7e52101cda2715bc4ca0a758884d67fb40669e (patch)
tree50bc8d47e2c218783b555a896ddfd68b580fce10 /Git/Branch.hs
parent3d9a971e66e3485da1da7895c4003f044bee65fd (diff)
working toward adjusted commit propigation
Diffstat (limited to 'Git/Branch.hs')
-rw-r--r--Git/Branch.hs20
1 files changed, 15 insertions, 5 deletions
diff --git a/Git/Branch.hs b/Git/Branch.hs
index ff209d44d..a0c15d171 100644
--- a/Git/Branch.hs
+++ b/Git/Branch.hs
@@ -48,15 +48,25 @@ currentUnsafe r = parse . firstLine
changed :: Branch -> Branch -> Repo -> IO Bool
changed origbranch newbranch repo
| origbranch == newbranch = return False
- | otherwise = not . null <$> diffs
+ | otherwise = not . null
+ <$> changed' origbranch newbranch [Param "-n1"] repo
where
- diffs = pipeReadStrict
+
+changed' :: Branch -> Branch -> [CommandParam] -> Repo -> IO String
+changed' origbranch newbranch extraps repo = pipeReadStrict ps repo
+ where
+ ps =
[ Param "log"
, Param (fromRef origbranch ++ ".." ++ fromRef newbranch)
- , Param "-n1"
, Param "--pretty=%H"
- ] repo
-
+ ] ++ extraps
+
+{- Lists commits that are in the second branch and not in the first branch. -}
+changedCommits :: Branch -> Branch -> [CommandParam] -> Repo -> IO [Sha]
+changedCommits origbranch newbranch extraps repo =
+ catMaybes . map extractSha . lines
+ <$> changed' origbranch newbranch extraps repo
+
{- Check if it's possible to fast-forward from the old
- ref to the new ref.
-