诗性大发,来个博客叭

编译gem5时

$ cd ~/work/rv32im-microarch/third_party/gem5

$ scons build/RISCV/gem5.opt -j$(nproc)

遇到提示

You're missing the pre-commit/commit-msg hooks. These hook help to ensure your code follows gem5's style rules on git commit and your commit messages follow our commit message requirements. This script will now install these hooks in your .git/hooks/ directory.

它具体检查什么

通常包括两类:

pre-commit

在你执行:

git commit

之前运行。

主要用于检查:

代码格式
空白字符
文件末尾换行
Python/C++ 风格
可能的 lint 问题

commit-msg

在你写完 commit message 之后运行。

主要用于检查:

提交信息格式
标题长度
是否符合 gem5 社区规范
是否包含合适的 tag / subsystem

如果检查不通过,Git commit 会被阻止。Git hooks 可以通过非零退出码中断提交流程,这是 Git hooks 的常规机制。

非常有趣!以后一定要应用到自己的项目当中

由 Redbean

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注