[clang] [clang-format] Add pre-commit CI env var support to git-clang-format (PR #188816)

Björn Schäpers via cfe-commits cfe-commits at lists.llvm.org
Thu Mar 26 12:46:31 PDT 2026


================
@@ -223,6 +228,16 @@ def main():
     )
     opts = p.parse_args(argv)
 
+    # When no commits are given explicitly and the pre-commit CI framework's
+    # environment variables are set, use them to define the diff range.
+    if not opts.args and not dash_dash:
+        from_ref = os.environ.get('PRE_COMMIT_FROM_REF')
----------------
HazardyKnusperkeks wrote:

Are these well known and commonly used variables, or are you planning to introduce them for this script? If the latter, maybe they should refer to clang-format.

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


More information about the cfe-commits mailing list