mirror of
https://github.com/go-gitea/gitea
synced 2024-09-19 02:06:04 +00:00
6e2a59e4ce
* Experimental support for git commit graph files and bloom filter index Signed-off-by: Filip Navara <filip.navara@gmail.com> * Force vendor of commitgraph Signed-off-by: Filip Navara <filip.navara@gmail.com> * Remove bloom filter experiment and debug prints * Remove old code for building commit graphs * Remove unused function * Remove mmap usage * gofmt * sort vendor/modules.txt * Add copyright header and log commit-graph error
36 lines
1.3 KiB
Go
36 lines
1.3 KiB
Go
package commitgraph
|
|
|
|
import (
|
|
"time"
|
|
|
|
"gopkg.in/src-d/go-git.v4/plumbing"
|
|
)
|
|
|
|
// CommitData is a reduced representation of Commit as presented in the commit graph
|
|
// file. It is merely useful as an optimization for walking the commit graphs.
|
|
type CommitData struct {
|
|
// TreeHash is the hash of the root tree of the commit.
|
|
TreeHash plumbing.Hash
|
|
// ParentIndexes are the indexes of the parent commits of the commit.
|
|
ParentIndexes []int
|
|
// ParentHashes are the hashes of the parent commits of the commit.
|
|
ParentHashes []plumbing.Hash
|
|
// Generation number is the pre-computed generation in the commit graph
|
|
// or zero if not available
|
|
Generation int
|
|
// When is the timestamp of the commit.
|
|
When time.Time
|
|
}
|
|
|
|
// Index represents a representation of commit graph that allows indexed
|
|
// access to the nodes using commit object hash
|
|
type Index interface {
|
|
// GetIndexByHash gets the index in the commit graph from commit hash, if available
|
|
GetIndexByHash(h plumbing.Hash) (int, error)
|
|
// GetNodeByIndex gets the commit node from the commit graph using index
|
|
// obtained from child node, if available
|
|
GetCommitDataByIndex(i int) (*CommitData, error)
|
|
// Hashes returns all the hashes that are available in the index
|
|
Hashes() []plumbing.Hash
|
|
}
|