diff options
Diffstat (limited to 'llvm/utils/git/code-format-helper.py')
| -rwxr-xr-x | llvm/utils/git/code-format-helper.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/llvm/utils/git/code-format-helper.py b/llvm/utils/git/code-format-helper.py index f1207026704e..d60d4131bc94 100755 --- a/llvm/utils/git/code-format-helper.py +++ b/llvm/utils/git/code-format-helper.py @@ -216,6 +216,17 @@ class ClangFormatHelper(FormatHelper): cf_cmd.append(args.start_rev) cf_cmd.append(args.end_rev) + # Gather the extension of all modified files and pass them explicitly to git-clang-format. + # This prevents git-clang-format from applying its own filtering rules on top of ours. + extensions = set() + for file in cpp_files: + _, ext = os.path.splitext(file) + extensions.add( + ext.strip(".") + ) # Exclude periods since git-clang-format takes extensions without them + cf_cmd.append("--extensions") + cf_cmd.append("'{}'".format(",".join(extensions))) + cf_cmd.append("--") cf_cmd += cpp_files |
