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

>From local testing, git diff-tree does not support three dot diffs correctly, 
>instead expecting the --merge-base flag to be passed along with two commits. 
>This patch updates the git-clang-format script to be correct.

I don't think we ever ran into this issue before because we never ended up 
using it. For the PR code format job I believe we would just explicitly pass 
the merge base, completely bypassing the problem.

>From 3050cce28fc06b81cca19a5f7e2e4ce7590a2985 Mon Sep 17 00:00:00 2001
From: Aiden Grossman <aidengross...@google.com>
Date: Mon, 25 Aug 2025 14:05:54 +0000
Subject: [PATCH] [clang-format] Use proper flags for git diff-tree

>From local testing, git diff-tree does not support three dot diffs
correctly, instead expecting the --merge-base flag to be passed along with
two commits. This patch updates the git-clang-format script to be
correct.

I don't think we ever ran into this issue before because we never ended
up using it. For the PR code format job I believe we would just
explicitly pass the merge base, completely bypassing the problem.
---
 clang/tools/clang-format/git-clang-format | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/clang/tools/clang-format/git-clang-format 
b/clang/tools/clang-format/git-clang-format
index e709803d9a3f1..fe2dd283d403e 100755
--- a/clang/tools/clang-format/git-clang-format
+++ b/clang/tools/clang-format/git-clang-format
@@ -419,7 +419,7 @@ def compute_diff(commits, files, staged, 
diff_common_commit):
     if len(commits) == 2:
         git_tool = "diff-tree"
         if diff_common_commit:
-            commits = [f"{commits[0]}...{commits[1]}"]
+            extra_args += ["--merge-base"]
     elif staged:
         extra_args += ["--cached"]
 

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to