From c25da4b04ae1eafa27623717a032de3d62ffc803 Mon Sep 17 00:00:00 2001 From: Richard Smith Date: Sun, 11 Oct 2020 14:20:01 -0700 Subject: [PATCH] Fix arc lint's clang-format rule: only format the file we were asked to format. This avoids diffs being applied in the work tree to files that are supposed to be excluded (clang tests), allows arc to properly provide interactive feedback for the formatting fixes, and reduces the number of files that we format, in a change affecting N files, from N^2 to N. --- utils/arcanist/clang-format.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils/arcanist/clang-format.sh b/utils/arcanist/clang-format.sh index 10b8189..473c0ff 100755 --- a/utils/arcanist/clang-format.sh +++ b/utils/arcanist/clang-format.sh @@ -52,7 +52,7 @@ trap 'cleanup' INT HUP QUIT TERM EXIT # because whether/how these are installed differs between distributions, # and we have an executable copy in the tree anyway. arc_base_commit=$(arc which --show-base) -git diff-index -U0 "${arc_base_commit}" \ +git diff-index -U0 "${arc_base_commit}" "${src_file}" \ | clang/tools/clang-format/clang-format-diff.py -style file -i -p1 cp -p "${src_file}" "${formatted_file}" -- 2.7.4