summaryrefslogtreecommitdiff
path: root/codespell_changed_files.sh
diff options
context:
space:
mode:
authorTom Rini <trini@konsulko.com>2024-10-16 08:10:14 -0600
committerTom Rini <trini@konsulko.com>2024-10-16 08:10:14 -0600
commitf3f86fd1fe0fb288356bff78f8a6fa2edf89e3fc (patch)
treef0a99ea87d92f63895a6d053e3185838ebecf2d0 /codespell_changed_files.sh
Squashed 'lib/lwip/lwip/' content from commit 0a0452b2c39b
git-subtree-dir: lib/lwip/lwip git-subtree-split: 0a0452b2c39bdd91e252aef045c115f88f6ca773
Diffstat (limited to 'codespell_changed_files.sh')
-rw-r--r--codespell_changed_files.sh26
1 files changed, 26 insertions, 0 deletions
diff --git a/codespell_changed_files.sh b/codespell_changed_files.sh
new file mode 100644
index 00000000000..638a18e2019
--- /dev/null
+++ b/codespell_changed_files.sh
@@ -0,0 +1,26 @@
+# Copyright 2017 Kaspar Schleiser <kaspar@schleiser.de>
+# Copyright 2014 Ludwig Knüpfer <ludwig.knuepfer@fu-berlin.de>
+# Copyright 2014 Hinnerk van Bruinehsen <h.v.bruinehsen@fu-berlin.de>
+# Copyright 2020 Jonathan Demeyer <jona.dem@gmail.com>
+#
+# This file is subject to the terms and conditions of the GNU Lesser
+# General Public License v2.1. See the file LICENSE in the top level
+# directory for more details.
+
+changed_files() {
+ : ${FILEREGEX:='\.([CcHh])$'}
+ : ${EXCLUDE:=''}
+ : ${DIFFFILTER:='ACMR'}
+
+ DIFFFILTER="--diff-filter=${DIFFFILTER}"
+
+ # select either all or only touched-in-branch files, filter through FILEREGEX
+ if [ -z "${BASE_BRANCH}" ]; then
+ FILES="$(git ls-tree -r --full-tree --name-only HEAD | grep -E ${FILEREGEX})"
+ else
+ FILES="$(git diff ${DIFFFILTER} --name-only ${BASE_BRANCH} | grep -E ${FILEREGEX})"
+ fi
+
+ # filter out negatives
+ echo "${FILES}" | grep -v -E ${EXCLUDE}
+}