summaryrefslogtreecommitdiff
path: root/Git/Ref.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2013-05-21 20:04:38 -0400
committerGravatar Joey Hess <joey@kitenet.net>2013-05-21 20:04:38 -0400
commite93cbb52e8d14dc88ef758654e0122d8b35b1e5f (patch)
treee7cf7cfd3cdb5c648aa92d4b02873491a11046a6 /Git/Ref.hs
parentc1f85cefd886c0e92747e6d9fc05c36dc6e31ea8 (diff)
include HEAD in CanPush shas
Diffstat (limited to 'Git/Ref.hs')
-rw-r--r--Git/Ref.hs12
1 files changed, 10 insertions, 2 deletions
diff --git a/Git/Ref.hs b/Git/Ref.hs
index d6e31897c..954b61a2e 100644
--- a/Git/Ref.hs
+++ b/Git/Ref.hs
@@ -59,8 +59,16 @@ sha branch repo = process <$> showref repo
{- List of (shas, branches) matching a given ref or refs. -}
matching :: [Ref] -> Repo -> IO [(Sha, Branch)]
-matching refs repo = map gen . lines <$>
- pipeReadStrict (Param "show-ref" : map (Param . show) refs) repo
+matching refs repo = matching' (map show refs) repo
+
+{- Includes HEAD in the output, if asked for it. -}
+matchingWithHEAD :: [Ref] -> Repo -> IO [(Sha, Branch)]
+matchingWithHEAD refs repo = matching' ("--head" : map show refs) repo
+
+{- List of (shas, branches) matching a given ref or refs. -}
+matching' :: [String] -> Repo -> IO [(Sha, Branch)]
+matching' ps repo = map gen . lines <$>
+ pipeReadStrict (Param "show-ref" : map Param ps) repo
where
gen l = let (r, b) = separate (== ' ') l
in (Ref r, Ref b)