* Resolve relative directory/file paths for stable comparison. * Settings declared at project scope may use project-relative paths; * JSON stores absolute paths. * * For git worktrees, resolve against the main checkout (canonical root) * instead of the worktree cwd. Project settings are checked
( source: MarketplaceSource, projectRoot?: string, )
| 247 | * installLocation. The canonical root is stable across all worktrees. |
| 248 | */ |
| 249 | function normalizeSource( |
| 250 | source: MarketplaceSource, |
| 251 | projectRoot?: string, |
| 252 | ): MarketplaceSource { |
| 253 | if ( |
| 254 | (source.source === 'directory' || source.source === 'file') && |
| 255 | !isAbsolute(source.path) |
| 256 | ) { |
| 257 | const base = projectRoot ?? getOriginalCwd() |
| 258 | const canonicalRoot = findCanonicalGitRoot(base) |
| 259 | return { |
| 260 | ...source, |
| 261 | path: resolve(canonicalRoot ?? base, source.path), |
| 262 | } |
| 263 | } |
| 264 | return source |
| 265 | } |
| 266 |
no test coverage detected