mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-01-25 10:43:19 -03:00
[scripts] lint-whitespace: check last N commits or unstaged changes
Get usage instructions: .lint-whitespace.sh -?
This commit is contained in:
parent
56910285fa
commit
8dbf740f80
1 changed files with 19 additions and 5 deletions
|
@ -7,12 +7,26 @@
|
||||||
# Check for new lines in diff that introduce trailing whitespace.
|
# Check for new lines in diff that introduce trailing whitespace.
|
||||||
|
|
||||||
# We can't run this check unless we know the commit range for the PR.
|
# We can't run this check unless we know the commit range for the PR.
|
||||||
|
|
||||||
|
while getopts "?" opt; do
|
||||||
|
case $opt in
|
||||||
|
?)
|
||||||
|
echo "Usage: .lint-whitespace.sh [N]"
|
||||||
|
echo " TRAVIS_COMMIT_RANGE='<commit range>' .lint-whitespace.sh"
|
||||||
|
echo " .lint-whitespace.sh -?"
|
||||||
|
echo "Checks unstaged changes, the previous N commits, or a commit range."
|
||||||
|
echo "TRAVIS_COMMIT_RANGE='47ba2c3...ee50c9e' .lint-whitespace.sh"
|
||||||
|
exit 0
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
if [ -z "${TRAVIS_COMMIT_RANGE}" ]; then
|
if [ -z "${TRAVIS_COMMIT_RANGE}" ]; then
|
||||||
echo "Cannot run lint-whitespace.sh without commit range. To run locally, use:"
|
if [ "$1" ]; then
|
||||||
echo "TRAVIS_COMMIT_RANGE='<commit range>' .lint-whitespace.sh"
|
TRAVIS_COMMIT_RANGE="HEAD~$1...HEAD"
|
||||||
echo "For example:"
|
else
|
||||||
echo "TRAVIS_COMMIT_RANGE='47ba2c3...ee50c9e' .lint-whitespace.sh"
|
TRAVIS_COMMIT_RANGE="HEAD"
|
||||||
exit 1
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
showdiff() {
|
showdiff() {
|
||||||
|
|
Loading…
Add table
Reference in a new issue