fix: tolerate autocrlf publish staging

This commit is contained in:
2026-07-19 17:29:03 +05:30
parent 180239ef4c
commit 14e2878417
+13 -1
View File
@@ -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);