aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--plumbing/object/commitnode.go5
-rw-r--r--plumbing/object/commitnode_graph.go2
-rw-r--r--plumbing/object/commitnode_object.go2
3 files changed, 6 insertions, 3 deletions
diff --git a/plumbing/object/commitnode.go b/plumbing/object/commitnode.go
index 62c0aef..22927f4 100644
--- a/plumbing/object/commitnode.go
+++ b/plumbing/object/commitnode.go
@@ -8,8 +8,8 @@ import (
"gopkg.in/src-d/go-git.v4/plumbing/storer"
)
-// CommitNode is generic interface encapsulating either Commit object or
-// graphCommitNode object
+// CommitNode is generic interface encapsulating a lightweight commit object retrieved
+// from CommitNodeIndex
type CommitNode interface {
// ID returns the Commit object id referenced by the commit graph node.
ID() plumbing.Hash
@@ -30,7 +30,6 @@ type CommitNode interface {
}
// CommitNodeIndex is generic interface encapsulating an index of CommitNode objects
-// and accessor methods for walking it as a directed graph
type CommitNodeIndex interface {
// Get returns a commit node from a commit hash
Get(hash plumbing.Hash) (CommitNode, error)
diff --git a/plumbing/object/commitnode_graph.go b/plumbing/object/commitnode_graph.go
index c57a258..9fc28a2 100644
--- a/plumbing/object/commitnode_graph.go
+++ b/plumbing/object/commitnode_graph.go
@@ -33,6 +33,8 @@ type graphCommitNodeIndex struct {
s storer.EncodedObjectStorer
}
+// NewGraphCommitNodeIndex returns CommitNodeIndex implementation that uses commit-graph
+// files as backing storage and falls back to object storage when necessary
func NewGraphCommitNodeIndex(commitGraph commitgraph.Index, s storer.EncodedObjectStorer) CommitNodeIndex {
return &graphCommitNodeIndex{commitGraph, s}
}
diff --git a/plumbing/object/commitnode_object.go b/plumbing/object/commitnode_object.go
index 08d8c0f..52316f8 100644
--- a/plumbing/object/commitnode_object.go
+++ b/plumbing/object/commitnode_object.go
@@ -15,6 +15,8 @@ type objectCommitNode struct {
commit *Commit
}
+// NewObjectCommitNodeIndex returns CommitNodeIndex implementation that uses
+// only object storage to load the nodes
func NewObjectCommitNodeIndex(s storer.EncodedObjectStorer) CommitNodeIndex {
return &objectCommitNodeIndex{s}
}