diff options
-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 |