Skip to content

Commit 31b6e18

Browse files
Siddhartha Bagariajoker-eph
Siddhartha Bagaria
authored andcommitted
Use git-clang-format as Arcanist linter
D49116 was using clang-format-diff because at the time of its writing, it needed to handle the subversion repo as well. Differential Revision: https://reviews.llvm.org/D77363
1 parent a0983ed commit 31b6e18

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

utils/arcanist/clang-format.sh

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@ set -euo pipefail
1010

1111
# To skip running all linters when creating/updating a diff, use `arc diff --nolint`.
1212

13-
if ! hash clang-format-diff >/dev/null; then
13+
if ! hash git-clang-format >/dev/null; then
1414
# advice severity level is completely non-disruptive.
1515
# switch to warning or error if you want to prompt the user.
1616
echo "advice"
17-
echo "clang-format-diff not found in user's PATH; not linting file."
17+
echo "git-clang-format not found in user's PATH; not linting file."
1818
echo "===="
1919
exit 0
2020
fi
@@ -37,13 +37,13 @@ trap 'cleanup' INT HUP QUIT TERM EXIT
3737

3838
# Arcanist can filter out lint messages for unchanged lines, but for that, we
3939
# need to generate line by line lint messages. Instead, we generate one lint
40-
# message on line 1, char 1 with file content edited using clang-format-diff.
40+
# message on line 1, char 1 with file content edited using git-clang-format.
4141
if git rev-parse --git-dir >/dev/null; then
4242
arc_base_commit=$(arc which --show-base)
4343
# An alternative is to use git-clang-format.
44-
git diff -U0 --no-color "${arc_base_commit}"| clang-format-diff -style LLVM -i -p1
44+
>&2 git-clang-format --quiet --force --style LLVM "${arc_base_commit}"
4545
else
46-
svn diff --diff-cmd=diff -x -U0 "${src_file}" | clang-format-diff -style LLVM -i
46+
>&2 echo "repo is expected to be a git directory"
4747
fi
4848

4949
cp -p "${src_file}" "${formatted_file}"

0 commit comments

Comments
 (0)