summaryrefslogtreecommitdiff
path: root/Annex/TaggedPush.hs
diff options
context:
space:
mode:
Diffstat (limited to 'Annex/TaggedPush.hs')
-rw-r--r--Annex/TaggedPush.hs8
1 files changed, 6 insertions, 2 deletions
diff --git a/Annex/TaggedPush.hs b/Annex/TaggedPush.hs
index 3b06170b3..13c53a3ca 100644
--- a/Annex/TaggedPush.hs
+++ b/Annex/TaggedPush.hs
@@ -30,7 +30,7 @@ import Utility.Base64
- Both UUIDs and Base64 encoded data are always legal to be used in git
- refs, per git-check-ref-format.
-}
-toTaggedBranch :: UUID -> Maybe String -> Git.Branch -> Git.Branch
+toTaggedBranch :: UUID -> Maybe String -> Git.Branch -> Git.Ref
toTaggedBranch u info b = Git.Ref $ intercalate "/" $ catMaybes
[ Just "refs/synced"
, Just $ fromUUID u
@@ -38,7 +38,7 @@ toTaggedBranch u info b = Git.Ref $ intercalate "/" $ catMaybes
, Just $ Git.fromRef $ Git.Ref.base b
]
-fromTaggedBranch :: Git.Branch -> Maybe (UUID, Maybe String)
+fromTaggedBranch :: Git.Ref -> Maybe (UUID, Maybe String)
fromTaggedBranch b = case splitc '/' $ Git.fromRef b of
("refs":"synced":u:info:_base) ->
Just (toUUID u, fromB64Maybe info)
@@ -46,6 +46,10 @@ fromTaggedBranch b = case splitc '/' $ Git.fromRef b of
Just (toUUID u, Nothing)
_ -> Nothing
+listTaggedBranches :: Annex [(Git.Sha, Git.Ref)]
+listTaggedBranches = filter (isJust . fromTaggedBranch . snd)
+ <$> inRepo Git.Ref.list
+
taggedPush :: UUID -> Maybe String -> Git.Ref -> Remote -> Git.Repo -> IO Bool
taggedPush u info branch remote = Git.Command.runBool
[ Param "push"