[clang-format] Use proper flags for git diff-tree (#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. 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.
NOKEYCHECK=True
GitOrigin-RevId: f09986aab575b41e2e210d937a46dfce82eceebc
diff --git a/git-clang-format b/git-clang-format
index e709803..fe2dd28 100755
--- a/git-clang-format
+++ b/git-clang-format
@@ -419,7 +419,7 @@
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"]