Pull Request已成功合入, 合并人@CANN-robot
(感谢 chenyx_2012 的贡献)Thanks for your pull-request.
The full list of commands accepted by me can be found at here。
You can get sig-info at here
PR Approval Progress
✅ Congratulations! All modules have met the lgtm and approve requirements.
Module Approval Details
| module | lgtm status | approve status |
|---|---|---|
| repo-cann/infrastructure | ✅ 宋常霞, shentukangjun (2/2) | ✅ 宋常霞 (1/1) |
💡 Tip:
- Committer can comment
/approveor/lgtm- Commenting
/approveimplies both code review (lgtm) and intent to merge (approve)
CLA Signature Pass
chenyx_2012, thanks for your pull request. All authors of the commits have signed the CLA. 👍


Based on the PR 描述和当前文件内容,我已理解变更的核心逻辑。以下是总结:
变更摘要
此 PR 修复了 docs/SC/pre-commit/oat_check.sh 脚本中 OAT 扫描完成后因修改 .gitignore 文件而导致 pre-commit 钩子检测到文件变更失败的问题。原脚本在检测到 .gitignore 中缺少 oat_reports/ 或 log/ 条目时,会主动向 .gitignore 文件追加写入这些条目,这触发了 pre-commit 对工作区文件变更的检查。修改后,脚本仅输出警告信息提示用户手动添加,不再自动修改 .gitignore 文件。
主要改动
- 移除自动写入
.gitignore的逻辑: 删除了原先在oat_reports/或log/条目缺失时自动 echo 追加到.gitignore的代码,改为仅通过echo "[OAT] [WARNING]..."输出提示信息,引导用户自行决定是否添加。 - 简化步骤 4 的检查流程:
docs/SC/pre-commit/oat_check.sh第 130–135 行的循环体从「检测缺失 → 自动写入 + 警告」简化为「检测缺失 → 仅警告」,减少了对仓库工作区的副作用,避免干扰 pre-commit 的文件变更判定。


🟡 Medium Priority
此 diff 移除了脚本自动向 .gitignore 追加 oat_reports/ 和 log/ 条目的逻辑(原第 133-134 行的 printf … >> "$_GITIGNORE"),改为仅打印警告(新第 133 行)。
但同目录下的文档 pre-commit配置指导书.md 第 333 行仍写着:
oat_reports/目录会被脚本自动加入.gitignore,无需手动维护。
该文档声明现在与代码实际行为矛盾:脚本不再自动维护 .gitignore,用户若不手动添加,扫描产物(oat_reports/result.txt)将成为 untracked 文件,可能被误提交。该文档虽然不在本次变更文件列表中,但其描述已因本次 diff 变为错误信息,会误导使用者。
建议:同步更新 pre-commit配置指导书.md 第 333 行,将"自动加入"改为"如未加入会打印警告,请手动添加",例如:
oat_reports/目录需手动加入.gitignore;若未加入,脚本会在每次提交时打印警告提示。


/compile


/lgtm
/approve


/lgtm


变更描述 / Description
修复OAT 扫描完成修改gitignore导致pre-commit 检查文件变更失败
改动类型 / Change Type
关联 Issue / Related Issues
测试信息 / Testing
检查清单 / Checklist