fix(windows): 沙箱发行版 git 增加 autocrlf/checkStat/trustctime 配置
This commit is contained in:
parent
04c9db8a5b
commit
5ef0a04ed0
@ -68,6 +68,15 @@ Write-Host "==> [6/6] 安装沙箱工具链(bubblewrap / bash / python3 / git
|
|||||||
$apk = Invoke-Wsl -d $DistroName -- sh -c "apk update && apk add bubblewrap bash ncurses-libs python3 git"
|
$apk = Invoke-Wsl -d $DistroName -- sh -c "apk update && apk add bubblewrap bash ncurses-libs python3 git"
|
||||||
if ($apk.Code -ne 0) { throw "apk 安装失败: $($apk.Output)" }
|
if ($apk.Code -ne 0) { throw "apk 安装失败: $($apk.Output)" }
|
||||||
|
|
||||||
|
# 与 Windows 端 Git for Windows 默认的 core.autocrlf=true 对齐:
|
||||||
|
# Windows 检出的工作区文件是 CRLF,沙箱 git 不开 autocrlf 会把全部文件误判为已修改
|
||||||
|
# (全量 +/-),且全量内容读取+xdiff 会让 git 命令慢到触发执行超时。
|
||||||
|
$null = Invoke-Wsl -d $DistroName -e git config --system core.autocrlf true
|
||||||
|
# 9P 挂载的 inode/ctime 语义与 Windows git 写入的索引不匹配,会导致沙箱 git 对全部
|
||||||
|
# 文件做内容重读(全树 status/diff >20s);放宽 stat 校验后只需秒级。
|
||||||
|
$null = Invoke-Wsl -d $DistroName -e git config --system core.checkStat minimal
|
||||||
|
$null = Invoke-Wsl -d $DistroName -e git config --system core.trustctime false
|
||||||
|
|
||||||
# 验收
|
# 验收
|
||||||
$verify = Invoke-Wsl -d $DistroName -- sh -c "bwrap --version && bash -c 'echo bash-ok' && python3 --version && git --version"
|
$verify = Invoke-Wsl -d $DistroName -- sh -c "bwrap --version && bash -c 'echo bash-ok' && python3 --version && git --version"
|
||||||
Write-Host $verify.Output
|
Write-Host $verify.Output
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user