File tree Expand file tree Collapse file tree 1 file changed +18
-1
lines changed
Expand file tree Collapse file tree 1 file changed +18
-1
lines changed Original file line number Diff line number Diff line change @@ -36,4 +36,21 @@ if ! command -v "$clang_bin" >/dev/null 2>&1; then
3636 fi
3737fi
3838
39- " $clang_bin " -style=file --dry-run -fallback-style=none -n -Werror $files
39+ clang_format_diff=" ${CLANG_FORMAT_DIFF:- clang-format-diff} "
40+ if ! command -v " $clang_format_diff " > /dev/null 2>&1 ; then
41+ if [[ -x " /c/Program Files/LLVM/share/clang/clang-format-diff.py" ]]; then
42+ clang_format_diff=" /c/Program Files/LLVM/share/clang/clang-format-diff.py"
43+ fi
44+ fi
45+
46+ for file in $files ; do
47+ echo " Checking lines of $file "
48+
49+ if [[ -n $RANGE ]]; then
50+ diff_output=$( git diff -U0 " $RANGE " -- " $file " )
51+ else
52+ diff_output=$( git diff -U0 --cached -- " $file " )
53+ fi
54+
55+ echo " $diff_output " | " $clang_format_diff " -style=file -fallback-style=none -p1
56+ done
You can’t perform that action at this time.
0 commit comments