diff options
Diffstat (limited to 'internal/commitquery/load.go')
| -rw-r--r-- | internal/commitquery/load.go | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/internal/commitquery/load.go b/internal/commitquery/load.go new file mode 100644 index 00000000..b795f7d9 --- /dev/null +++ b/internal/commitquery/load.go @@ -0,0 +1,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) +} |
