aboutsummaryrefslogtreecommitdiff
path: root/contrib/devtools
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@gmail.com>2018-03-06 23:09:27 +0100
committerWladimir J. van der Laan <laanwj@gmail.com>2018-03-06 23:09:40 +0100
commit14475e2dcdc8cc3a0ded2b1185fc6a9eb59102f3 (patch)
treebebc52d934320a0754cbc5b0db6d6e23bf7f4a13 /contrib/devtools
parent9fb3898c3fb00d4de005f2f56af1d8ac0e4616aa (diff)
parent40b17f5f9106e572420dada04c15ec452a8f4f41 (diff)
downloadbitcoin-14475e2dcdc8cc3a0ded2b1185fc6a9eb59102f3.tar.xz
Merge #12097: [scripts] lint-whitespace: use perl instead of grep -P
40b17f5f9 [scripts] lint-whitespace: use perl instead of grep -P (Sjors Provoost) Pull request description: MacOS does not support `grep -P` out of the box. This change makes it easier for developers to check for whitespace problems locally. Based on [this](https://stackoverflow.com/a/16658690) and [this](https://serverfault.com/a/504387) Stack Exchange answer. Tested with: ```sh export TRAVIS_COMMIT_RANGE='fe78c9a...62e0453' contrib/devtools/lint-whitespace.sh This diff appears to have added new lines with tab characters instead of spaces. The following changes were suspected: diff --git a/src/test/bignum_tests.cpp b/src/test/bignum_tests.cpp @@ -0,0 +1,110 @@ + num.setint64(n); ``` Tree-SHA512: 37c342a0ca2580289cf326a278a051a7c21ba918d6b2143fd9987f159fab85f1de3d770fcf532a642cd5d1957afc8595678128196e102dc473924758f133db7f
Diffstat (limited to 'contrib/devtools')
-rwxr-xr-xcontrib/devtools/lint-whitespace.sh4
1 files changed, 2 insertions, 2 deletions
diff --git a/contrib/devtools/lint-whitespace.sh b/contrib/devtools/lint-whitespace.sh
index af9a57910a..670a56285d 100755
--- a/contrib/devtools/lint-whitespace.sh
+++ b/contrib/devtools/lint-whitespace.sh
@@ -59,7 +59,7 @@ if showdiff | grep -E -q '^\+.*\s+$'; then
fi
# Check if tab characters were found in the diff.
-if showcodediff | grep -P -q '^\+.*\t'; then
+if showcodediff | perl -nle '$MATCH++ if m{^\+.*\t}; END{exit 1 unless $MATCH>0}' > /dev/null; then
echo "This diff appears to have added new lines with tab characters instead of spaces."
echo "The following changes were suspected:"
FILENAME=""
@@ -81,7 +81,7 @@ if showcodediff | grep -P -q '^\+.*\t'; then
fi
echo "$line"
fi
- done < <(showcodediff | grep -P '^(diff --git |@@|\+.*\t)')
+ done < <(showcodediff | perl -nle 'print if m{^(diff --git |@@|\+.*\t)}')
RET=1
fi