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)
| 1586 | // - AsString() of a and b are different |
| 1587 | // - Pin() of a and b are different |
| 1588 | func 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 | } |
| 1604 | func (srv *Server) CurrentWorkspaceLock(ctx context.Context) (*workspace.Lock, bool, error) { |
| 1605 | client, err := srv.clientFromContext(ctx) |
| 1606 | if err != nil { |