aboutsummaryrefslogtreecommitdiffstats
path: root/plumbing/object/commitgraph/commitnode_graph.go
diff options
context:
space:
mode:
authorPaulo Gomes <pjbgf@linux.com>2023-10-13 23:06:19 +0100
committerGitHub <noreply@github.com>2023-10-13 23:06:19 +0100
commit72ce9961c676b73c9bdd0678b64af7b0a42253f8 (patch)
tree3e6c8e7b0706918455a2d85fe6629242acab163f /plumbing/object/commitgraph/commitnode_graph.go
parent24261e8288b2483628d69c751dd310ac79c38b2e (diff)
parent69b88d9bda44ebfe1d56a7624b956d9e20818c0e (diff)
downloadgo-git-72ce9961c676b73c9bdd0678b64af7b0a42253f8.tar.gz
Merge pull request #869 from zeripath/graph-generation-2v5.10.0
plumbing: commitgraph, Add generation v2 support
Diffstat (limited to 'plumbing/object/commitgraph/commitnode_graph.go')
-rw-r--r--plumbing/object/commitgraph/commitnode_graph.go7
1 files changed, 7 insertions, 0 deletions
diff --git a/plumbing/object/commitgraph/commitnode_graph.go b/plumbing/object/commitgraph/commitnode_graph.go
index 252b518..0f51e3b 100644
--- a/plumbing/object/commitgraph/commitnode_graph.go
+++ b/plumbing/object/commitgraph/commitnode_graph.go
@@ -120,6 +120,13 @@ func (c *graphCommitNode) Generation() uint64 {
return c.commitData.Generation
}
+func (c *graphCommitNode) GenerationV2() uint64 {
+ // If the commit-graph file was generated with older Git version that
+ // set the generation to zero for every commit the generation assumption
+ // is still valid. It is just less useful.
+ return c.commitData.GenerationV2
+}
+
func (c *graphCommitNode) Commit() (*object.Commit, error) {
return object.GetCommit(c.gci.s, c.hash)
}