https://github.com/edenreich created https://github.com/llvm/llvm-project/pull/108721
## Summary Currently it's not backward compatible, because the flag -list-ignored doesn't exists on older version of clang-format. To make this tool still backward compatible, we can first check if the .clang-format-ignore file exists before we run clang-format with the -list-ignored flag. >From 04bf30e5d21460d8ceef1e2ef514b3c4653530f4 Mon Sep 17 00:00:00 2001 From: Eden Reich <eden.re...@gmail.com> Date: Sun, 15 Sep 2024 00:25:50 +0200 Subject: [PATCH] Fix git-clang-format Currently it's not backward compatible, because the flag -list-ignored doesn't exists on older version of clang-format. To make this tool still backward compatible, we can first check if the .clang-format-ignore file exists before we run clang-format with the -list-ignored flag. --- clang/tools/clang-format/git-clang-format | 2 ++ 1 file changed, 2 insertions(+) diff --git a/clang/tools/clang-format/git-clang-format b/clang/tools/clang-format/git-clang-format index bacbd8de245666..997644045c1f25 100755 --- a/clang/tools/clang-format/git-clang-format +++ b/clang/tools/clang-format/git-clang-format @@ -402,6 +402,8 @@ def filter_symlinks(dictionary): def filter_ignored_files(dictionary, binary): """Delete every key in `dictionary` that is ignored by clang-format.""" + if not os.path.exists('.clang-format-ignore'): + return ignored_files = run(binary, '-list-ignored', *dictionary.keys()) if not ignored_files: return _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits