From 7dbe0e5c78fb1266cfc8c520778d14ec8efde711 Mon Sep 17 00:00:00 2001 From: Swung0x48 Date: Fri, 16 Oct 2026 06:30:59 -0400 Subject: [PATCH] [Docs] (.git-blame-ignore-revs, CONTRIBUTING.md): list the reformat for git blame and update the format rules --- .git-blame-ignore-revs | 5 +++++ CONTRIBUTING.md | 5 +++-- 2 files changed, 8 insertions(+), 2 deletions(-) create mode 100644 .git-blame-ignore-revs diff --git a/.git-blame-ignore-revs b/.git-blame-ignore-revs new file mode 100644 index 00000000..8ea99669 --- /dev/null +++ b/.git-blame-ignore-revs @@ -0,0 +1,5 @@ +# Layout-only commits for `git blame` to look past: +# git config blame.ignoreRevsFile .git-blame-ignore-revs + +# clang-format every C and C++ source +f4994ee36e3aa2d53c22370e471c976a3fae719f diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 9da74872..eb3eb6ca 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -52,8 +52,9 @@ Example: ## Code -- Format the lines you change with `.clang-format`, using clang-format 23. Install it with `pip install 'clang-format==23.1.3'`; `git clang-format ` from the same package formats only the lines changed since ``. `scripts/format_code.sh` reformats whole files, so do not use it on files you only touched. -- `.inc` files are fragments included in the middle of a `.cpp` file, inside a namespace, or are generated tables. clang-format cannot format them on their own, so the check skips them. Match the indentation of the file that includes them. +- C and C++ sources are formatted with `.clang-format`, using clang-format 23. Install it with `pip install 'clang-format==23.1.3'`. `git clang-format ` from the same package formats the lines changed since ``, and `scripts/format_code.sh` formats every file the check covers. The tree is already formatted, so neither touches lines you did not change. +- The commit that reformatted the whole tree is listed in `.git-blame-ignore-revs`. Run `git config blame.ignoreRevsFile .git-blame-ignore-revs` once so that `git blame` looks past it. +- `.inc` files are fragments included in the middle of a `.cpp` file, inside a namespace, or are generated tables. clang-format cannot format them on their own, so the check skips them. Match the indentation of the file that includes them. The check also skips generated files and the GL export table, `MG_Impl/GLImpl/Exporting/Definitions.cpp`. - Text files are UTF-8. - These source files under `MobileGL/`, `scripts/` and `tools/` start with the license header: - C, C++, `.inc`, GLSL, Java and JavaScript modules, with `//` comments;