diff --git a/scripts/release.ts b/scripts/release.ts index afb7cfa4..40d3a50f 100644 --- a/scripts/release.ts +++ b/scripts/release.ts @@ -121,7 +121,19 @@ function validateStaging(all: PackageInfo[], version: string) { } function requireCleanAndPushed(repo: string, label: string) { - if (output("git", ["status", "--porcelain"], repo)) { + // `status --porcelain` can report false worktree changes on Windows when a + // generated LF file replaces an autocrlf checkout with identical Git + // content. Compare canonical diffs and untracked files instead. + const worktreeChanged = run("git", ["diff", "--quiet"], repo, { + capture: true, + allowFailure: true, + }).status; + const indexChanged = run("git", ["diff", "--cached", "--quiet"], repo, { + capture: true, + allowFailure: true, + }).status; + const untracked = output("git", ["ls-files", "--others", "--exclude-standard"], repo); + if (worktreeChanged || indexChanged || untracked) { throw new Error(`${label} repository has uncommitted changes.`); } run("git", ["fetch", "origin"], repo);