| 1 |
package commitgraph |
| 2 |
|
| 3 |
import ( |
| 4 |
"time" |
| 5 |
|
| 6 |
"github.com/go-git/go-git/v5/plumbing" |
| 7 |
) |
| 8 |
|
| 9 |
// CommitData is a reduced representation of Commit as presented in the commit graph |
| 10 |
// file. It is merely useful as an optimization for walking the commit graphs. |
| 11 |
// |
| 12 |
// Deprecated: This package uses the wrong types for Generation and Index in CommitData. |
| 13 |
// Use the v2 package instead. |
| 14 |
type CommitData struct { |
| 15 |
// TreeHash is the hash of the root tree of the commit. |
| 16 |
TreeHash plumbing.Hash |
| 17 |
// ParentIndexes are the indexes of the parent commits of the commit. |
| 18 |
ParentIndexes []int |
| 19 |
// ParentHashes are the hashes of the parent commits of the commit. |
| 20 |
ParentHashes []plumbing.Hash |
| 21 |
// Generation number is the pre-computed generation in the commit graph |
| 22 |
// or zero if not available |
| 23 |
Generation int |
| 24 |
// When is the timestamp of the commit. |
| 25 |
When time.Time |
| 26 |
} |
| 27 |
|
| 28 |
// Index represents a representation of commit graph that allows indexed |
| 29 |
// access to the nodes using commit object hash |
| 30 |
// |
| 31 |
// Deprecated: This package uses the wrong types for Generation and Index in CommitData. |
| 32 |
// Use the v2 package instead. |
| 33 |
type Index interface { |
| 34 |
// GetIndexByHash gets the index in the commit graph from commit hash, if available |
| 35 |
GetIndexByHash(h plumbing.Hash) (int, error) |
| 36 |
// GetNodeByIndex gets the commit node from the commit graph using index |
| 37 |
// obtained from child node, if available |
| 38 |
GetCommitDataByIndex(i int) (*CommitData, error) |
| 39 |
// Hashes returns all the hashes that are available in the index |
| 40 |
Hashes() []plumbing.Hash |
| 41 |
} |