shithub: furgit

ref: af08c84539f9353718604988ba27ae3c466860fc
dir: /internal/commitquery/load.go/

View raw version
package commitquery

// ensureLoaded completes one node's metadata load if it has not been loaded yet.
func (ctx *Context) ensureLoaded(idx NodeIndex) error {
	if ctx.nodes[idx].loaded {
		return nil
	}

	if ctx.nodes[idx].hasGraphPos {
		return ctx.loadByGraphPos(idx)
	}

	return ctx.loadByOID(idx)
}