File: codespell_changed_files.sh

package info (click to toggle)
lwip 2.2.1%2Bdfsg1-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 10,028 kB
  • sloc: ansic: 109,551; cs: 6,714; sh: 115; makefile: 112; perl: 81
file content (26 lines) | stat: -rw-r--r-- 951 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
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}
}