Skip to content

Commit 30fa13e

Browse files
committed
Merged pull request mongodb#766
2 parents b0d97b0 + a71b440 commit 30fa13e

File tree

2 files changed

+23
-3
lines changed

2 files changed

+23
-3
lines changed

.clang-format

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ DerivePointerAlignment: false
4646
DisableFormat: false
4747
ExperimentalAutoDetectBinPacking: false
4848
ForEachMacros: []
49-
IncludeBlocks: Preserve
5049
IncludeCategories:
5150
- Regex: '^"(llvm|llvm-c|clang|clang-c)/'
5251
Priority: 2
@@ -55,7 +54,6 @@ IncludeCategories:
5554
- Regex: '.*'
5655
Priority: 1
5756
IndentCaseLabels: true
58-
IndentPPDirectives: None
5957
IndentWidth: 4
6058
IndentWrappedFunctionNames: false
6159
KeepEmptyLinesAtTheStartOfBlocks: true

scripts/clang-format.sh

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,28 @@ if test x"$1" = xchanged; then
1212
FILES="$FILES1 $FILES2 $FILES3"
1313
fi
1414

15+
# Find clang-format, we prefer -6.0, but also allow binaries without -suffix as
16+
# long as they're >= 6.0.0
17+
CLANG_FORMAT=`which clang-format-6.0`
18+
19+
if [ -z "$CLANG_FORMAT" ]; then
20+
CLANG_FORMAT=`which clang-format`
21+
fi
22+
23+
if [ -z "$CLANG_FORMAT" ]; then
24+
echo "Couldn't find clang-format"
25+
exit
26+
fi
27+
28+
VERSION=`$CLANG_FORMAT -version | cut -d " " -f 3`
29+
VERSION_MAJOR=`echo $VERSION | cut -d "." -f 1`
30+
31+
if [ $VERSION_MAJOR -lt 6 ]; then
32+
echo "Found clang-format $VERSION but we need >= 6.0.0"
33+
exit
34+
fi
35+
36+
# Run formatter
1537
for i in $FILES; do
16-
clang-format-7 -i $i
38+
$CLANG_FORMAT -i $i
1739
done

0 commit comments

Comments
 (0)