Skip to content

Commit 96cfe5a

Browse files
committed
Cleanup duplicated configs
1 parent 259abea commit 96cfe5a

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

src/lib/server/nvim-sync/config/syncRepoInfo.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,18 @@ export async function syncExistingRepoInfo(token: string, config: NeovimConfig)
9393
}
9494
}
9595
if (nameChanged) {
96+
const existingWithNewName = await prismaClient.neovimConfig.findUnique({
97+
where: {
98+
owner_repo_root: { owner: repo.owner.login, repo: repo.name, root: config.root }
99+
}
100+
});
101+
if (existingWithNewName) {
102+
console.log(
103+
`[SYNC_CONFIGS] [WARNING] ${config.owner}/${config.repo} -> ${repo.name} — stale duplicate, deleting`
104+
);
105+
await prismaClient.neovimConfig.delete({ where: { id: config.id } });
106+
return existingWithNewName;
107+
}
96108
await prismaClient.neovimConfig.update({
97109
where: { id: config.id },
98110
data: { repo: repo.name }

0 commit comments

Comments
 (0)