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;