[0076] gf fmt 为 clang-format 添加文件缓存#872
Open
da-liii wants to merge 1 commit into
Open
Conversation
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
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.
摘要
为
gf fmt的 C++ 格式化路径(clang-format)添加与 Scheme 格式化一致的文件内容缓存,使重复格式化大量未改动文件时跳过clang-format进程调用。主要改动
tools/fmt/liii/goldfmt-cache.scm:把原先scheme-fmt.scm中的缓存函数抽取为共享模块。tools/fmt/liii/scheme-fmt.scm:复用新的共享缓存模块,删除本地缓存实现。tools/fmt/liii/cpp-fmt.scm:format-cpp-file/format-one-cpp先查缓存,命中则跳过clang-format;check-cpp-file同样使用缓存;format-cpp-files返回(total updated cached),与 Scheme 协议保持一致。tests/liii/goldfmt-cache-test.scm覆盖缓存路径计算、命中/写入逻辑。devel/0076.md任务文档。测试
bin/gf tests/liii/goldfmt-cache-test.scm通过(5/5)。bin/gf fmt --check在当前仓库通过。~/git/mogan实测:注意事项
缓存键为文件内容 SHA-256,按 Goldfish 版本隔离。
.clang-format等配置变更不会自动失效缓存,需要手动清理~/.cache/goldfish/fmt。🤖 Generated with Claude Code