aboutsummaryrefslogtreecommitdiff
path: root/Git/Ref.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2013-05-21 18:24:29 -0400
committerGravatar Joey Hess <joey@kitenet.net>2013-05-21 18:24:29 -0400
commitb6ebb173e7b5d4d07577cb2918e7d1a24fbc1f60 (patch)
tree8c994e00b091c448d80737aa99bbc181701eee04 /Git/Ref.hs
parent14f2a42ca4131a7a51a9e10a94521639b971bccd (diff)
XMPP: Avoid redundant and unncessary pushes. Note that this breaks compatibility with previous versions of git-annex, which will refuse to accept any XMPP pushes from this version.
Diffstat (limited to 'Git/Ref.hs')
-rw-r--r--Git/Ref.hs21
1 files changed, 12 insertions, 9 deletions
diff --git a/Git/Ref.hs b/Git/Ref.hs
index c98802cb7..d6e31897c 100644
--- a/Git/Ref.hs
+++ b/Git/Ref.hs
@@ -1,6 +1,6 @@
{- git ref stuff
-
- - Copyright 2011 Joey Hess <joey@kitenet.net>
+ - Copyright 2011-2013 Joey Hess <joey@kitenet.net>
-
- Licensed under the GNU GPL version 3 or higher.
-}
@@ -13,6 +13,9 @@ import Git.Command
import Data.Char (chr)
+headRef :: Ref
+headRef = Ref "HEAD"
+
{- Converts a fully qualified git ref into a user-visible string. -}
describe :: Ref -> String
describe = show . base
@@ -54,18 +57,18 @@ sha branch repo = process <$> showref repo
process [] = Nothing
process s = Just $ Ref $ firstLine s
-{- List of (refs, branches) matching a given ref spec. -}
-matching :: Ref -> Repo -> IO [(Ref, Branch)]
-matching ref repo = map gen . lines <$>
- pipeReadStrict [Param "show-ref", Param $ show ref] 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
where
gen l = let (r, b) = separate (== ' ') l
in (Ref r, Ref b)
-{- List of (refs, branches) matching a given ref spec.
- - Duplicate refs are filtered out. -}
-matchingUniq :: Ref -> Repo -> IO [(Ref, Branch)]
-matchingUniq ref repo = nubBy uniqref <$> matching ref repo
+{- List of (shas, branches) matching a given ref spec.
+ - Duplicate shas are filtered out. -}
+matchingUniq :: [Ref] -> Repo -> IO [(Sha, Branch)]
+matchingUniq refs repo = nubBy uniqref <$> matching refs repo
where
uniqref (a, _) (b, _) = a == b