Skip to content

Conversation

@llvmbot
Copy link
Member

@llvmbot llvmbot commented Aug 26, 2025

Backport f09986a

Requested by: @boomanaiden154

@llvmbot
Copy link
Member Author

llvmbot commented Aug 26, 2025

@owenca What do you think about merging this PR to the release branch?

@llvmbot
Copy link
Member Author

llvmbot commented Aug 26, 2025

@llvm/pr-subscribers-clang-format

Author: None (llvmbot)

Changes

Backport f09986a

Requested by: @boomanaiden154


Full diff: https://github.com/llvm/llvm-project/pull/155466.diff

1 Files Affected:

  • (modified) clang/tools/clang-format/git-clang-format (+1-1)
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"]
 

@github-project-automation github-project-automation bot moved this from Needs Triage to Needs Merge in LLVM Release Status Aug 27, 2025
@tru tru merged commit ca11cf3 into llvm:release/21.x Sep 3, 2025
@github-project-automation github-project-automation bot moved this from Needs Merge to Done in LLVM Release Status Sep 3, 2025
@github-actions
Copy link

github-actions bot commented Sep 3, 2025

@boomanaiden154 (or anyone else). If you would like to add a note about this fix in the release notes (completely optional). Please reply to this comment with a one or two sentence description of the fix. When you are done, please add the release:note label to this PR.

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. From my reading, the documentation
(https://git-scm.com/docs/git-diff-tree) also confirms this. 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.

(cherry picked from commit f09986a)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Development

Successfully merging this pull request may close these issues.

4 participants