From 6b3cf0072e00033259656aa342c87fdc193dc7f7 Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Thu, 14 Nov 2024 19:08:02 +0100 Subject: [PATCH] fix(installer): potential endless loop on windows --- .changeset/olive-mails-marry.md | 6 ++++++ packages/installer/src/migration/tasks/gitignore.ts | 4 ++-- 2 files changed, 8 insertions(+), 2 deletions(-) create mode 100644 .changeset/olive-mails-marry.md diff --git a/.changeset/olive-mails-marry.md b/.changeset/olive-mails-marry.md new file mode 100644 index 00000000..9bd9e39f --- /dev/null +++ b/.changeset/olive-mails-marry.md @@ -0,0 +1,6 @@ +--- +"content-collections": patch +"@content-collections/installer": patch +--- + +Fix potential endless loop on windows diff --git a/packages/installer/src/migration/tasks/gitignore.ts b/packages/installer/src/migration/tasks/gitignore.ts index 262fa263..d5888d0c 100644 --- a/packages/installer/src/migration/tasks/gitignore.ts +++ b/packages/installer/src/migration/tasks/gitignore.ts @@ -1,11 +1,11 @@ import { existsSync } from "node:fs"; import fs from "node:fs/promises"; -import { join } from "node:path"; +import { dirname, join } from "node:path"; import { Task } from "./index.js"; function findGitIgnore(directory: string): string | null { let current = directory; - while (current !== "/") { + while (current !== dirname("/")) { const gitIgnore = join(current, ".gitignore"); if (existsSync(gitIgnore)) { return gitIgnore;