diff options
author | Emma Vukelj <emmavukelj@google.com> | 2019-07-19 11:42:03 -0700 |
---|---|---|
committer | Emma Vukelj <emmavukelj@google.com> | 2019-07-19 21:00:44 +0000 |
commit | e78ad6731d8c72c27b5c4e197bd38cfa9f823e04 (patch) | |
tree | c4f453ba02edd447ecf2fb6b0a52674297efb0f4 /toolchain_utils_githooks | |
parent | d8b3f5e449a336824100a15d33d9a3b60fe6a4b3 (diff) | |
download | toolchain-utils-e78ad6731d8c72c27b5c4e197bd38cfa9f823e04.tar.gz |
Toolchain-Utils: Only lint existing files
This CL changes the presubmit hook to only lint files that exist, to
avoid trying to lint files that a CL removed and failing fatally.
BUG=None
TEST=created new branch, confirmed existing files are linted and
deleted files are not.
Change-Id: Ie812914fb2b33de75cda5a036df18750dcc6e6bf
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/1710018
Reviewed-by: Caroline Tice <cmtice@chromium.org>
Reviewed-by: George Burgess <gbiv@chromium.org>
Tested-by: Emma Vukelj <emmavukelj@google.com>
Diffstat (limited to 'toolchain_utils_githooks')
-rwxr-xr-x | toolchain_utils_githooks/check-presubmit | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/toolchain_utils_githooks/check-presubmit b/toolchain_utils_githooks/check-presubmit index e67611f5..713e3add 100755 --- a/toolchain_utils_githooks/check-presubmit +++ b/toolchain_utils_githooks/check-presubmit @@ -36,12 +36,20 @@ spawn_child() { child_pids+=( "$!" ) } + +# only lint existing files +declare -a to_lint +for file; do + if [[ -f "${file}" ]]; then + to_lint+=("${file}") + fi +done + # We have a few things to do in parallel here. To avoid interleaving their # output, we pipe them all to tempfiles, then cat those tempfiles. - -spawn_child "${mydir}/check-lint" "$@" -spawn_child "${mydir}/check-format" "$@" -spawn_child "${mydir}/../run_tests_for.py" "$@" +spawn_child "${mydir}/check-lint" "${to_lint[@]}" +spawn_child "${mydir}/check-format" "${to_lint[@]}" +spawn_child "${mydir}/../run_tests_for.py" "${to_lint[@]}" success=true for i in "${!child_pids[@]}"; do |