[llvm] [Github] Use three dot diff for darker in code format action (PR #74704)

Aiden Grossman via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 7 00:56:37 PST 2023


https://github.com/boomanaiden154 created https://github.com/llvm/llvm-project/pull/74704

Using a two dot diff allows changes made in main after the merge base to show up in the formatting diff. Using a three dot diff fixes this and ensures that only changes made in the source branch (branch from the PR author) will get passed along to the formatter.

Without this, issues like #73873 occur.

>From 96cc0e518cf6d8651e76bda67c2d9bea4fb2da6b Mon Sep 17 00:00:00 2001
From: Aiden Grossman <agrossman154 at yahoo.com>
Date: Thu, 7 Dec 2023 00:54:21 -0800
Subject: [PATCH] [Github] Use three dot diff for darker in code format action

Using a two dot diff allows changes made in main after the merge base to
show up in the formatting diff. Using a three dot diff fixes this and
ensures that only changes made in the source branch (branch from the PR
author) will get passed along to the formatter.
---
 llvm/utils/git/code-format-helper.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/llvm/utils/git/code-format-helper.py b/llvm/utils/git/code-format-helper.py
index 8876ba7a14deb..f89f060b3fe5e 100644
--- a/llvm/utils/git/code-format-helper.py
+++ b/llvm/utils/git/code-format-helper.py
@@ -185,7 +185,7 @@ def format_run(
             "--check",
             "--diff",
             "-r",
-            f"{args.start_rev}..{args.end_rev}",
+            f"{args.start_rev}...{args.end_rev}",
         ] + py_files
         print(f"Running: {' '.join(darker_cmd)}")
         self.darker_cmd = darker_cmd



More information about the llvm-commits mailing list