diff options
author | Emma Vukelj <emmavukelj@google.com> | 2019-07-19 14:46:13 -0700 |
---|---|---|
committer | Emma Vukelj <emmavukelj@google.com> | 2019-07-19 22:38:16 +0000 |
commit | 8ff790343d702be4c9fe55e3519d89a8501d4bf9 (patch) | |
tree | 3a9730f0c519dd2f587718211fe00e9db5e47e27 /toolchain_utils_githooks | |
parent | e78ad6731d8c72c27b5c4e197bd38cfa9f823e04 (diff) | |
download | toolchain-utils-8ff790343d702be4c9fe55e3519d89a8501d4bf9.tar.gz |
Toolchain-Utils: Fix bug when no files to lint/check
This CL fixes a bug in the previous one editing pre-submit which caused
presubmit to fail when no new files have been added.
BUG=None
TEST=created new branches, confirmed presubmit is run correctly
Change-Id: I1a1b968220e60db12d05bbdab25646bfe2eb42e0
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/1710022
Reviewed-by: George Burgess <gbiv@chromium.org>
Reviewed-by: Caroline Tice <cmtice@chromium.org>
Tested-by: Emma Vukelj <emmavukelj@google.com>
Diffstat (limited to 'toolchain_utils_githooks')
-rwxr-xr-x | toolchain_utils_githooks/check-presubmit | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/toolchain_utils_githooks/check-presubmit b/toolchain_utils_githooks/check-presubmit index 713e3add..0f770234 100755 --- a/toolchain_utils_githooks/check-presubmit +++ b/toolchain_utils_githooks/check-presubmit @@ -38,18 +38,22 @@ spawn_child() { # only lint existing files +files_exist=false declare -a to_lint for file; do if [[ -f "${file}" ]]; then + files_exist=true 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" "${to_lint[@]}" -spawn_child "${mydir}/check-format" "${to_lint[@]}" -spawn_child "${mydir}/../run_tests_for.py" "${to_lint[@]}" +if "${files_exist}"; then + spawn_child "${mydir}/check-lint" "${to_lint[@]}" + spawn_child "${mydir}/check-format" "${to_lint[@]}" + spawn_child "${mydir}/../run_tests_for.py" "${to_lint[@]}" +fi success=true for i in "${!child_pids[@]}"; do |