fix: tolerate autocrlf publish staging
This commit is contained in:
+13
-1
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user