shithub: furgit

ref: 27ef9a7e1f2589d1a0eeee4cd6d36d1926989cf2
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)
}