Safe Haskell | None |
---|---|
Language | Haskell2010 |
Data.Git.Graph.Util
- newtype ObjId = ObjId {}
- resolveNameMaybe :: Git -> String -> IO (Maybe ObjId)
- resolveName :: Git -> String -> IO ObjId
- listReferences :: Git -> IO [(ObjId, String)]
- loadCommits :: MonadIO m => Git -> ((ObjId, Commit) -> ObjId -> a -> m (a, Maybe Commit)) -> a -> ObjId -> Maybe Commit -> m a
- loadCommitsMulti :: MonadIO m => Git -> ((ObjId, Commit) -> ObjId -> a -> m (a, Maybe Commit)) -> a -> [(ObjId, Maybe Commit)] -> m a
Documentation
A git object identifier. This is a SHA-1 hash. Its common textual representation is a 40-byte ASCII hexadecimal string.
resolveNameMaybe :: Git -> String -> IO (Maybe ObjId) Source #
For a given ref name - HEAD or branch or tag - determine its ref hash.
resolveName :: Git -> String -> IO ObjId Source #
For a given ref name - HEAD or branch or tag - determine its ref hash.
listReferences :: Git -> IO [(ObjId, String)] Source #
List the available references in a git repo, sorted by ref name. The list includes HEAD, branches and tags.
Arguments
:: MonadIO m | |
=> Git | Open git repository context |
-> ((ObjId, Commit) -> ObjId -> a -> m (a, Maybe Commit)) | Given a child commit, one of its parent commits and an |
-> a | Initial value |
-> ObjId | Hash of the commit whose ancestor graph should be loaded |
-> Maybe Commit | If you already read the commit for the ref passed as the previous
parameter, pass the commit here to avoid repeated loading of it.
Otherwise, pass |
-> m a |
Load the entire graph of commits which are ancestors of the given ref
(and that ref itself). Fold the commit structure into a value of type a
inside monad m
.
This is a low-level function which operates on a commit tree, i.e. the same ref may be visited more than once (if it has more than one child commit). You can use the provided flexibility to implement graph algorithms over the commits, or build a graph using some graph library and use that library's tools for further processing.
Arguments
:: MonadIO m | |
=> Git | Open git repository context |
-> ((ObjId, Commit) -> ObjId -> a -> m (a, Maybe Commit)) | Given a child commit, one of its parent commits and an |
-> a | Initial value |
-> [(ObjId, Maybe Commit)] | Commits whose ancestors to scan. For each commit, pass:
|
-> m a |
Like loadCommits
, but takes a list of refs and goes over all their
ancestors. This is just a convenience shortcut which folds a list with
loadCommits
. Passing a list with a single element is the same as running
loadCommits
.