Commit cb2c44bb authored by Daniele Piccini's avatar Daniele Piccini
Browse files

fix: condition for PRE_COMMIT_FILE null check

The condition in the pre_commit_setup function was incorrectly checking
for a non-empty PRE_COMMIT_FILE, while the error message suggested it
should fail on a null value. This commit changes the condition to
correctly check for an empty or unset PRE_COMMIT_FILE.

- Changed [[ -n "${PRE_COMMIT_FILE}" ]] to [[ -z "${PRE_COMMIT_FILE}" ]]
- This ensures the function fails when PRE_COMMIT_FILE is empty or unset,
  aligning with the error message

This fix improves the reliability of the pre-commit setup process by
properly validating the PRE_COMMIT_FILE variable.
parent b38903ee
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -337,7 +337,7 @@ stages:
  function pre_commit_setup() {
    log_info "Performing pre-commit setup..."
    # maybe install default hooks
    if [[ -n "${PRE_COMMIT_FILE}" ]]
    if [[ -z "${PRE_COMMIT_FILE}" ]]
    then
      fail "PRE_COMMIT_FILE can't be set to null value"
    fi