-
Notifications
You must be signed in to change notification settings - Fork 15.2k
[clang-format] Use proper flags for git diff-tree #155247
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[clang-format] Use proper flags for git diff-tree #155247
Conversation
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.
|
@llvm/pr-subscribers-clang-format Author: Aiden Grossman (boomanaiden154) ChangesFrom 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. Full diff: https://github.com/llvm/llvm-project/pull/155247.diff 1 Files Affected:
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"]
|
|
/cherry-pick f09986a |
|
/pull-request #155466 |
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)
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.