commitgraph
packageThis package is not in the latest version of its module.
Details
Validgo.mod file
The Go module system was introduced in Go 1.11 and is the official dependency management solution for Go.
Redistributable license
Redistributable licenses place minimal restrictions on how software can be used, modified, and redistributed.
Tagged version
Modules with tagged versions give importers more predictable builds.
Stable version
When a project reaches major version v1 it is considered stable.
- Learn more about best practices
Repository
Links
Documentation¶
Overview¶
Package commitgraph provides an interface for efficient traversal over Gitcommit graph either through the regular object storage, or optionally withthe index stored in commit-graph file (Git 2.18+).
The API and functionality of this package are considered EXPERIMENTAL and isnot considered stable nor production ready.
Index¶
- type CommitNode
- type CommitNodeIndex
- type CommitNodeIter
- func NewCommitNodeIterAuthorDateOrder(c CommitNode, seenExternal map[plumbing.Hash]bool, ignore []plumbing.Hash) CommitNodeIter
- func NewCommitNodeIterCTime(c CommitNode, seenExternal map[plumbing.Hash]bool, ignore []plumbing.Hash) CommitNodeIter
- func NewCommitNodeIterDateOrder(c CommitNode, seenExternal map[plumbing.Hash]bool, ignore []plumbing.Hash) CommitNodeIter
- func NewCommitNodeIterTopoOrder(c CommitNode, seenExternal map[plumbing.Hash]bool, ignore []plumbing.Hash) CommitNodeIter
Constants¶
This section is empty.
Variables¶
This section is empty.
Functions¶
This section is empty.
Types¶
typeCommitNode¶
type CommitNode interface {// ID returns the Commit object id referenced by the commit graph node.ID()plumbing.Hash// Tree returns the Tree referenced by the commit graph node.Tree() (*object.Tree,error)// CommitTime returns the Committer.When time of the Commit referenced by the commit graph node.CommitTime()time.Time// NumParents returns the number of parents in a commit.NumParents()int// ParentNodes return a CommitNodeIter for parents of specified node.ParentNodes()CommitNodeIter// ParentNode returns the ith parent of a commit.ParentNode(iint) (CommitNode,error)// ParentHashes returns hashes of the parent commits for a specified nodeParentHashes() []plumbing.Hash// Generation returns the generation of the commit for reachability analysis.// Objects with newer generation are not reachable from objects of older generation.Generation()uint64// GenerationV2 stores the corrected commit date for the commits// It combines the contents of the GDA2 and GDO2 sections of the commit-graph// with the commit time portion of the CDAT section.GenerationV2()uint64// Commit returns the full commit object from the nodeCommit() (*object.Commit,error)}CommitNode is generic interface encapsulating a lightweight commit object retrievedfrom CommitNodeIndex
typeCommitNodeIndex¶
type CommitNodeIndex interface {// Get returns a commit node from a commit hashGet(hashplumbing.Hash) (CommitNode,error)}CommitNodeIndex is generic interface encapsulating an index of CommitNode objects
funcNewGraphCommitNodeIndex¶
func NewGraphCommitNodeIndex(commitGraphcommitgraph.Index, sstorer.EncodedObjectStorer)CommitNodeIndex
NewGraphCommitNodeIndex returns CommitNodeIndex implementation that uses commit-graphfiles as backing storage and falls back to object storage when necessary
funcNewObjectCommitNodeIndex¶
func NewObjectCommitNodeIndex(sstorer.EncodedObjectStorer)CommitNodeIndex
NewObjectCommitNodeIndex returns CommitNodeIndex implementation that usesonly object storage to load the nodes
typeCommitNodeIter¶
type CommitNodeIter interface {Next() (CommitNode,error)ForEach(func(CommitNode)error)errorClose()}CommitNodeIter is a generic closable interface for iterating over commit nodes.
funcNewCommitNodeIterAuthorDateOrder¶added inv5.10.0
func NewCommitNodeIterAuthorDateOrder(cCommitNode,seenExternal map[plumbing.Hash]bool,ignore []plumbing.Hash,)CommitNodeIter
NewCommitNodeIterAuthorDateOrder returns a CommitNodeIter that walks the commit history,starting at the given commit and visiting its parents in Author Time order but with theconstraint that no parent is emitted before its children are emitted.
This matches `git log --author-order`
This ordering requires that commit objects need to be loaded into memory - thus thisordering is likely to be slower than other orderings.
funcNewCommitNodeIterCTime¶
func NewCommitNodeIterCTime(cCommitNode,seenExternal map[plumbing.Hash]bool,ignore []plumbing.Hash,)CommitNodeIter
NewCommitNodeIterCTime returns a CommitNodeIter that walks the commit history,starting at the given commit and visiting its parents while preserving Committer Time order.this is close in order to `git log` but does not guarantee topological order and willorder things incorrectly occasionally.The given callback will be called for each visited commit. Each commit willbe visited only once. If the callback returns an error, walking will stopand will return the error. Other errors might be returned if the historycannot be traversed (e.g. missing objects). Ignore allows to skip somecommits from being iterated.
funcNewCommitNodeIterDateOrder¶added inv5.10.0
func NewCommitNodeIterDateOrder(cCommitNode,seenExternal map[plumbing.Hash]bool,ignore []plumbing.Hash,)CommitNodeIter
NewCommitNodeIterDateOrder returns a CommitNodeIter that walks the commit history,starting at the given commit and visiting its parents in Committer Time and Generation order,but with the constraint that no parent is emitted before its children are emitted.
This matches `git log --date-order`
funcNewCommitNodeIterTopoOrder¶added inv5.10.0
func NewCommitNodeIterTopoOrder(cCommitNode,seenExternal map[plumbing.Hash]bool,ignore []plumbing.Hash,)CommitNodeIter
NewCommitNodeIterTopoOrder returns a CommitNodeIter that walks the commit history,starting at the given commit and visiting its parents in a topological order butwith the constraint that no parent is emitted before its children are emitted.
This matches `git log --topo-order`