MCPcopy Index your code
hub / github.com/dagger/dagger / isSameModuleReference

Function isSameModuleReference

engine/server/session.go:1588–1603  ·  view source on GitHub ↗

Returns true if the module source a is the same as b or they come from the core module. Returns false if: - AsString() of a and b are different - Pin() of a and b are different

(a *core.ModuleSource, b *core.ModuleSource)

Source from the content-addressed store, hash-verified

1586// - AsString() of a and b are different
1587// - Pin() of a and b are different
1588func isSameModuleReference(a *core.ModuleSource, b *core.ModuleSource) bool {
1589 // If one of them is empty, that means they are from code module so they shouldn't
1590 // be compared.
1591 if a.AsString() == "" || b.AsString() == "" {
1592 return true
1593 }
1594
1595 // Match by canonical module identity:
1596 // - local: absolute source-code path (context dir + sourceSubpath)
1597 // - git: clone ref + sourceSubpath
1598 // plus pin equality for immutable provenance.
1599 if canonicalModuleReference(a) != canonicalModuleReference(b) {
1600 return false
1601 }
1602 return a.Pin() == b.Pin()
1603}
1604func (srv *Server) CurrentWorkspaceLock(ctx context.Context) (*workspace.Lock, bool, error) {
1605 client, err := srv.clientFromContext(ctx)
1606 if err != nil {

Callers 2

serveModuleMethod · 0.85

Calls 3

canonicalModuleReferenceFunction · 0.85
AsStringMethod · 0.45
PinMethod · 0.45

Tested by 1