[libcxx] [llvm] Add pre-commit hooks and git config for libc++ & git-clang-format. (PR #73798)

via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 29 09:04:42 PST 2023


================
@@ -0,0 +1,31 @@
+#!/bin/bash
----------------
EricWF wrote:

Sorry I misunderstood the initial question, so I got a bit confused. These scripts do separate things.

This script should be installed under `.git/hooks/pre-commit`, and it will auto-run whenever the user types `git commit` in their checkout of LLVM.

The ` code-format-tools/llvm/utils/git/code-format-helper.py` is a utility for creating check-runs in a github actions workflow. It also acts as a shallow wrapper around git-clang-format, but it does not run locally nor is it meant for formatting code.

That said, we probably don't need this second github workflow, since these two tools should produce almost the same outcome (ours will format files without extensions that are outside of `libcxx/include`, but the `code-format-helper.py` limits itself to allowing no-extension files under `libcxx/include`.

If we want to fully merge their behaviors, we need to make git-clang-format handle libc++ non-extension headers better. I would be happy taking the same approach `code-format-helper.py` takes 

What am I missing?

https://github.com/llvm/llvm-project/pull/73798


More information about the llvm-commits mailing list