From e8fe5aaf6abce2765143c25f542ca76f7ff56cdc Mon Sep 17 00:00:00 2001 From: Eric Harney Date: Tue, 22 Jan 2019 12:08:58 -0500 Subject: [PATCH] fast8 improvements Determines how many commits to check based on the $FAST8_NUM_COMMITS env variable. If set to "smart", it uses git to try to run against all unsubmitted commits. This allows fast8 to be more useful when actively developing a series of patches. Change-Id: I0adfba626ba2ea3479faf0f6ade712f14d3080d3 --- tools/fast8.sh | 12 +++++++++++- tox.ini | 1 + 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/tools/fast8.sh b/tools/fast8.sh index 2b3e22abda5..22976ce09b8 100755 --- a/tools/fast8.sh +++ b/tools/fast8.sh @@ -1,7 +1,17 @@ #!/bin/bash +NUM_COMMITS=${FAST8_NUM_COMMITS:-1} + +if [[ $NUM_COMMITS = "smart" ]]; then + # Run on all commits not submitted yet + # (sort of -- only checks vs. "master" since this is easy) + NUM_COMMITS=$(git cherry master | wc -l) +fi + +echo "Checking last $NUM_COMMITS commits." + cd $(dirname "$0")/.. -CHANGED=$(git diff --name-only HEAD~1 | tr '\n' ' ') +CHANGED=$(git diff --name-only HEAD~${NUM_COMMITS} | tr '\n' ' ') # Skip files that don't exist # (have been git rm'd) diff --git a/tox.ini b/tox.ini index cc5b8434237..7cad0e821d8 100644 --- a/tox.ini +++ b/tox.ini @@ -91,6 +91,7 @@ basepython = python3 envdir = {toxworkdir}/pep8 commands = {toxinidir}/tools/fast8.sh +passenv = FAST8_NUM_COMMITS [testenv:pylint] basepython = python3