fix(deploy): 中文路径被 git 转义 → 按需重建误判为"两端全建"
首次真机验证按需重建时踩到:`git diff --name-only` 默认 core.quotePath=true, docs/部署说明.md 会输出成 "docs/\351\203\250...",匹配不到 docs/* 规则, 一路掉进"拿不准就两端都重建"的兜底分支——只改文档却重建了 backend + web。 修复: - 新增 classify-changes.sh --git-diff <from> <to> [repo],内部用 `git -c core.quotePath=false diff --name-only`,部署脚本改走它; - 分类时顺带剥掉可能残留的首尾引号; - 补回归用例:临时 git 仓库里提交中文文件名,断言改动列表保留中文原文、 且最终分类为空(不加 --git-diff 时该用例会失败,已实测复现)。
This commit is contained in:
@@ -267,7 +267,9 @@ detect_changed_services() {
|
||||
return
|
||||
fi
|
||||
|
||||
CHANGED_FILES="$(git -C "${PROJECT_ROOT}" diff --name-only "${last_sha}" "${head_sha}" 2>/dev/null || true)"
|
||||
# 走 classify-changes.sh 的 --git-diff 而不是直接 git diff:
|
||||
# 那里关掉了 core.quotePath,中文路径(docs/xxx.md)不会被转义成 "\351..." 而匹配不上规则。
|
||||
CHANGED_FILES="$(bash "${PROJECT_ROOT}/deploy/lib/classify-changes.sh" --git-diff "${last_sha}" "${head_sha}" 2>/dev/null || true)"
|
||||
DIFF_KNOWN=true
|
||||
|
||||
env_hash="$(file_sha256 "${ENV_FILE}")"
|
||||
|
||||
Reference in New Issue
Block a user