Repository navigation
fix(safety): O123 L3 不再把普通 git commit/checkout/merge 误报为已修改(依赖 #117) - #122
Merged
Merged
Conversation
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
QiaolongLi1201
force-pushed
the
fix/o123-git-commit-l3
branch
from
October 12, 2026 05:52
9692315 to
05d9c02
Compare
…ig.worktree, name keys in last line
…cp remote.*.url by value (PM 口径)
…/merge (HEAD/refs judged by content)
QiaolongLi1201
force-pushed
the
fix/o123-git-commit-l3
branch
from
October 12, 2026 06:16
05d9c02 to
e37c968
Compare
QiaolongLi1201
added a commit
that referenced
this pull request
Oct 12, 2026
QiaolongLi1201
added a commit
that referenced
this pull request
Oct 12, 2026
QiaolongLi1201
added a commit
that referenced
this pull request
Oct 12, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
O123(P1)普通
git commit被 L3 误报「已被修改 .git/refs/heads/…」exit 9。人工实现,不走自举。根因
L3 快照监视
.git/HEAD和.git/refs/**。原来靠filterExpectedGitMetadataChanges(command)用正则git\s+(commit|checkout|…)匹配命令文本来丢弃 HEAD/refs 变化,所以:git -c user.name=u commit --allow-empty(UX a5 复现)、git -C dir commit、脚本里提交,正则都匹配不上,导致refs/heads/master被报「已被修改」,exit 9;git commit,HEAD/refs 上的任何变化都会被丢掉,包括ref: ../x。改法(QA 路径放行名单,按内容判,不看命令文本)
.git/HEAD、.git/refs/**新内容是提交号(40/64 hex),或ref: refs/<name>(不含..、.、空段、反斜杠、控制字符)时,算正常,不报。删除 loose ref(branch -d)也不报。ref: ../x→「.git/HEAD 指向仓库外路径(不在 refs/ 下)」;内容既不是提交号也不是 refs 引用;被换成软链或目录;HEAD 被删除。.git/refs目录本身的 mtime 变化不报,类型变了(例如换成软链)照报。filterExpectedGitMetadataChanges不再丢弃带 reason 的异常变化。info/**、objects/info/alternates、objects/info/http-alternates、modules/*/config、worktrees/*/config。index、objects、logs、ORIG_HEAD、COMMIT_EDITMSG、packed-refs 和以前一样不监视。测试
test/o123-git-commit-l3.spec.mjs(15 项):git -c … commit --allow-empty、add+commit、checkout -b/merge/tag/branch -d、detached → 无变化../x、ref 里写垃圾、ref 换成指向仓库外的软链、提交后加 hook、提交+hooksPath、info/alternates/modules config → 照报moss -p(zh/en):add+commit、-ccommit --allow-empty、checkout -b + merge 都是 exit 0,末行没有「已被修改」;用脚本写 hooks/x、HEAD→../x、hooksPath 都是 exit 9,末行写出具体路径或键名npm run check绿;npm test373 个文件全过(Node 22.16)风险
modules/*/config,git submodule改它时会报(fail-closed)。