Skip to content

Commit f09986a

Browse files
[clang-format] Use proper flags for git diff-tree (llvm#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.
1 parent 83dbba6 commit f09986a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

clang/tools/clang-format/git-clang-format

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -419,7 +419,7 @@ def compute_diff(commits, files, staged, diff_common_commit):
419419
if len(commits) == 2:
420420
git_tool = "diff-tree"
421421
if diff_common_commit:
422-
commits = [f"{commits[0]}...{commits[1]}"]
422+
extra_args += ["--merge-base"]
423423
elif staged:
424424
extra_args += ["--cached"]
425425

0 commit comments

Comments
 (0)