dist/licenses: add and use diff-filter
This commit is contained in:
parent
0cd1f34c4a
commit
1574c2bb76
@ -43,7 +43,8 @@ script:
|
|||||||
- make -s -C ./examples/default info-concurrency
|
- make -s -C ./examples/default info-concurrency
|
||||||
- git rebase riot/master || git rebase --abort
|
- git rebase riot/master || git rebase --abort
|
||||||
|
|
||||||
- ./dist/tools/licenses/check.sh master || exit
|
- ./dist/tools/licenses/check.sh master --diff-filter=MR
|
||||||
|
- ./dist/tools/licenses/check.sh master --diff-filter=AC || exit
|
||||||
|
|
||||||
# TODO:
|
# TODO:
|
||||||
# Remove the `AC` argument when all headers have been
|
# Remove the `AC` argument when all headers have been
|
||||||
|
|||||||
23
dist/tools/licenses/check.sh
vendored
23
dist/tools/licenses/check.sh
vendored
@ -11,7 +11,6 @@ TMP="${CHECKROOT}/.tmp"
|
|||||||
ROOT=$(git rev-parse --show-toplevel)
|
ROOT=$(git rev-parse --show-toplevel)
|
||||||
LICENSES=$(ls "${LICENSEDIR}")
|
LICENSES=$(ls "${LICENSEDIR}")
|
||||||
EXIT_CODE=0
|
EXIT_CODE=0
|
||||||
BRANCH="${1}"
|
|
||||||
|
|
||||||
# reset output dir
|
# reset output dir
|
||||||
rm -fr "${OUTPUT}"
|
rm -fr "${OUTPUT}"
|
||||||
@ -20,11 +19,31 @@ for LICENSE in ${LICENSES}; do
|
|||||||
echo -n '' > "${OUTPUT}/${LICENSE}"
|
echo -n '' > "${OUTPUT}/${LICENSE}"
|
||||||
done
|
done
|
||||||
|
|
||||||
|
# If no branch but an option is given, unset BRANCH.
|
||||||
|
# Otherwise, consume this parameter.
|
||||||
|
BRANCH="${1}"
|
||||||
|
if echo "${BRANCH}" | grep -q '^-'; then
|
||||||
|
BRANCH=""
|
||||||
|
else
|
||||||
|
if [ -n "${BRANCH}" ]; then
|
||||||
|
shift 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# If the --diff-filter option is given, consume this parameter.
|
||||||
|
# Set the default DIFFFILTER option otherwise.
|
||||||
|
DIFFFILTER="${1}"
|
||||||
|
if echo "${DIFFFILTER}" | grep -q '^--diff-filter='; then
|
||||||
|
shift 1
|
||||||
|
else
|
||||||
|
DIFFFILTER="--diff-filter=ACMR"
|
||||||
|
fi
|
||||||
|
|
||||||
# select files to check
|
# select files to check
|
||||||
if [ -z "${BRANCH}" ]; then
|
if [ -z "${BRANCH}" ]; then
|
||||||
FILES="$(git ls-tree -r --full-tree --name-only HEAD | grep -E '\.([sSch]|cpp)$')"
|
FILES="$(git ls-tree -r --full-tree --name-only HEAD | grep -E '\.([sSch]|cpp)$')"
|
||||||
else
|
else
|
||||||
FILES="$(git diff --diff-filter=ACMR --name-only ${BRANCH} | grep -E '\.([sSchp]|cpp)$')"
|
FILES="$(git diff ${DIFFFILTER} --name-only ${BRANCH} | grep -E '\.([sSchp]|cpp)$')"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# categorize files
|
# categorize files
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user