aboutsummaryrefslogtreecommitdiff
path: root/internal/commitquery/load.go
blob: b795f7d9e7054b7b840a0823039aa40b0a0f9ff5 (about) (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
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)
}