summaryrefslogtreecommitdiff
path: root/src/Repo.hs
diff options
context:
space:
mode:
Diffstat (limited to 'src/Repo.hs')
-rw-r--r--src/Repo.hs11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/Repo.hs b/src/Repo.hs
index 78d0c60..b6ad8d4 100644
--- a/src/Repo.hs
+++ b/src/Repo.hs
@@ -16,6 +16,7 @@ module Repo (
readBranch,
readTag, tryReadTag,
listCommits, listCommitsFrom,
+ listTags,
mergeBase,
findUpstreamRef,
@@ -287,6 +288,16 @@ listCommitsFrom commitRepo from except = liftIO $ do
commitDetails <- newMVar Nothing
return Commit {..}
+listTags :: MonadIO m => Repo -> m [ Tag Commit ]
+listTags repo = liftIO $ do
+ out <- runGitCommand repo
+ [ "for-each-ref", "refs/tags"
+ , "--format=%(objecttype) %(refname:short)"
+ ]
+ fmap catMaybes $ forM (map words $ lines out) $ \case
+ [ "tag", tname ] -> tryReadTag repo (T.pack tname)
+ _ -> return Nothing
+
mergeBase :: MonadIO m => Repo -> [ CommitId ] -> m [ Commit ]
mergeBase commitRepo cids = liftIO $ do
out <- runGitCommand commitRepo $ "merge-base" : "--all" : "--octopus" : map showCommitId cids