diff --git a/gitnexus/src/core/run-analyze.ts b/gitnexus/src/core/run-analyze.ts index 471f3dd33..3d7a0de79 100644 --- a/gitnexus/src/core/run-analyze.ts +++ b/gitnexus/src/core/run-analyze.ts @@ -1482,8 +1482,8 @@ async function preparedAnalysisName(repoPath: string, options: AnalyzeOptions): if ( existing && existing.name !== path.basename(path.resolve(existing.path)) && - existing.name !== path.basename(resolveRepoIdentityRoot(existing.path)) && - existing.name !== inferred + existing.name !== inferred && + existing.name !== path.basename(resolveRepoIdentityRoot(existing.path)) ) return existing.name; return inferred ?? path.basename(resolveRepoIdentityRoot(repoPath)); diff --git a/gitnexus/src/storage/repo-manager.ts b/gitnexus/src/storage/repo-manager.ts index d338b71ae..96ea04498 100644 --- a/gitnexus/src/storage/repo-manager.ts +++ b/gitnexus/src/storage/repo-manager.ts @@ -944,6 +944,7 @@ export class RegistryNameCollisionError extends Error { const hasCustomAlias = (entry: RegistryEntry, inferredName: string | null): boolean => { const resolved = path.resolve(entry.path); if (entry.name === path.basename(resolved)) return false; + if (inferredName && entry.name === inferredName) return false; // Canonical-root-derived names are not user aliases either (#1259): // a worktree registered under the canonical repo's basename // (e.g. `{name: 'repo', path: '/repo/wt-feature'}`) must re-register @@ -955,7 +956,6 @@ const hasCustomAlias = (entry: RegistryEntry, inferredName: string | null): bool // — analyze canonical, then analyze worktree, then re-analyze worktree // — would break on the third call. if (entry.name === path.basename(resolveRepoIdentityRoot(resolved))) return false; - if (inferredName && entry.name === inferredName) return false; return true; };