-
Notifications
You must be signed in to change notification settings - Fork 13.5k
Clang format action picking up diffs from other commits #73873
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
Comments
Looks like this is due to the default diff strategy in The best way to fix this seems to be to add a new option to |
This patch adds in the ability to do a "three dot" git-clang-format between two commits. This looks at the diff between the second commit and the common merge base rather than comparing at the point of the specified commits. This is needed to improve the reliability of the LLVM code formatting CI action which currently breaks in some cases where files have been modified in the upstream tree and when the person created their branch, leaving phantom formatting diffs that weren't touched by the PR author. Part of a fix for llvm#73873
This patch adds in the ability to do a "three dot" git-clang-format between two commits. This looks at the diff between the second commit and the common merge base rather than comparing at the point of the specified commits. This is needed to improve the reliability of the LLVM code formatting CI action which currently breaks in some cases where files have been modified in the upstream tree and when the person created their branch, leaving phantom formatting diffs that weren't touched by the PR author. Part of a fix for #73873
Using a two dot diff allows changes made in main after the merge base to show up in the formatting diff. Using a three dot diff fixes this and ensures that only changes made in the source branch (branch from the PR author) will get passed along to the formatter. Without this, issues like #73873 occur.
This has been fixed in #75132 by only checking the diff through the merge base. A todo has been added to convert this to the option in |
There is at least one instance where the clang format action picked up the diff from a different commit in the same file that wasn't included in the current PR.
This occurred in #73506, with the job also trying to format 7c93452. I'm guessing this has to do with an out of date merge base, but this should work regardless.
I've saved the branch to my fork at https://github.com/boomanaiden154/llvm-project/tree/indvars-dead-code so that the issue can be reproduced.
Will do some more investigation.
The text was updated successfully, but these errors were encountered: