================
@@ -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')
----------------
goyaladitya05 wrote:

Yeah, these are official pre-commit env variables. Pre-commit sets them 
automatically with `--from-ref/--to-ref`.

Official Docs: 
https://github.com/pre-commit/pre-commit/blob/main/pre_commit/commands/run.py#L391-L392

https://github.com/llvm/llvm-project/pull/188816
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to