* test(#3663): failing-first rows for w027 path-casing normalization * fix(#3663): fold path casing only on win32 in the w027 active-worktree check * fix(#3663): close review findings — seam-owned compare key, deterministic case pin * chore(#3663): backfill changeset pr number --------- Co-authored-by: sim <sim@local>
This commit is contained in:
@@ -56,6 +56,21 @@ export function posixNormalize(p: string): string {
|
||||
return p.replace(/\\/g, '/');
|
||||
}
|
||||
|
||||
/**
|
||||
* #3663 — comparison key for a path that must equal another path regardless
|
||||
* of spelling: separator form (forward slashes via posixNormalize), relative
|
||||
* segments and trailing separators (path.resolve + strip), and — ONLY on
|
||||
* win32's case-insensitive filesystem — letter casing. POSIX stays
|
||||
* case-sensitive: differently-cased paths are genuinely different
|
||||
* directories there. This module owns the platform-conditional fold so the
|
||||
* policy lives at the seam instead of accreting per-call-site copies (the
|
||||
* class init.cts's normalizeForCompare/toComparableRaw predate).
|
||||
*/
|
||||
export function toComparablePathKey(p: string, platform: string = process.platform): string {
|
||||
const normalized = posixNormalize(path.resolve(p)).replace(/\/+$/g, '');
|
||||
return platform === 'win32' ? normalized.toLowerCase() : normalized;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return true when a managed hook command must be prefixed with PowerShell's
|
||||
* call operator so a quoted executable token is invokable by the target
|
||||
|
||||
Reference in New Issue
Block a user