Movatterモバイル変換


[0]ホーム

URL:


commitgraph

package
v5.16.4Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 23, 2025 License:Apache-2.0Imports:9Imported by:16

Details

Repository

github.com/go-git/go-git

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

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.

funcNewCommitNodeIterAuthorDateOrderadded 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.

funcNewCommitNodeIterDateOrderadded 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`

funcNewCommitNodeIterTopoOrderadded 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`

Source Files

View all Source files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f orF : Jump to
y orY : Canonical URL
go.dev uses cookies from Google to deliver and enhance the quality of its services and to analyze traffic.Learn more.

[8]ページ先頭

©2009-2025 Movatter.jp