Fix wrong string concatination in validation
authorKrzGalcz <k.galczynski@eyeo.com>
Wed, 13 Nov 2024 15:50:50 +0100
changeset 25715 3200f6603386
parent 25714 074ea5523f84
child 25716 b62514f9d365
Fix wrong string concatination in validation
pre-commit-src/pre-commit-script.sh
--- a/pre-commit-src/pre-commit-script.sh
+++ b/pre-commit-src/pre-commit-script.sh
@@ -582,17 +582,17 @@ check_pre_commit_files() {
     pre_commit_tests_path='pre-commit-src/tests/pre-commit-tests.sh'
     check_if_file_exists "$pre_commit_tests_path"
     local matched_pre_commit_tests_in_unstaged=$(grep -x "$pre_commit_tests_path" <<< "$unstaged_files" || echo '')
     if [ -n "$matched_pre_commit_tests_in_unstaged" ]; then
         last_error="Unstaged changes detected in pre-commit-tests file. Stage pre-commit tests changes before continuing."
         return 1
     fi
     # Only if something changed in pre commit or pre commit tests the unit tests should be run
-    if [ -z "$matched_pre_commit_in_unstaged" + "$matched_pre_commit_script_in_unstaged" "$matched_pre_commit_tests_in_unstaged" ]; then
+    if [ -z "$matched_pre_commit_in_unstaged$matched_pre_commit_script_in_unstaged$matched_pre_commit_tests_in_unstaged" ]; then
         check_unit_tests
     fi
 }
 
 # For testing purposes only if the script has no arguments or the argument is main the process should run
 # thanks to that the script can be tested without running the main function
 if [ -z "${1:-}" ]; then
     echo 'Running pre-commit checks...'