codespell_changed_files.sh 951 B

1234567891011121314151617181920212223242526
  1. # Copyright 2017 Kaspar Schleiser <kaspar@schleiser.de>
  2. # Copyright 2014 Ludwig Knüpfer <ludwig.knuepfer@fu-berlin.de>
  3. # Copyright 2014 Hinnerk van Bruinehsen <h.v.bruinehsen@fu-berlin.de>
  4. # Copyright 2020 Jonathan Demeyer <jona.dem@gmail.com>
  5. #
  6. # This file is subject to the terms and conditions of the GNU Lesser
  7. # General Public License v2.1. See the file LICENSE in the top level
  8. # directory for more details.
  9. changed_files() {
  10. : ${FILEREGEX:='\.([CcHh])$'}
  11. : ${EXCLUDE:=''}
  12. : ${DIFFFILTER:='ACMR'}
  13. DIFFFILTER="--diff-filter=${DIFFFILTER}"
  14. # select either all or only touched-in-branch files, filter through FILEREGEX
  15. if [ -z "${BASE_BRANCH}" ]; then
  16. FILES="$(git ls-tree -r --full-tree --name-only HEAD | grep -E ${FILEREGEX})"
  17. else
  18. FILES="$(git diff ${DIFFFILTER} --name-only ${BASE_BRANCH} | grep -E ${FILEREGEX})"
  19. fi
  20. # filter out negatives
  21. echo "${FILES}" | grep -v -E ${EXCLUDE}
  22. }