diff --git a/lib/functions/buildFileList.sh b/lib/functions/buildFileList.sh index b4ef39ea..a7dff909 100755 --- a/lib/functions/buildFileList.sh +++ b/lib/functions/buildFileList.sh @@ -228,26 +228,6 @@ function BuildFileList() { fi fi - ############################### - # Load the ignored files list # - ############################### - debug "Loading the files list that Git ignores..." - mapfile -t GIT_IGNORED_FILES < <(git -C "${GITHUB_WORKSPACE}" status --ignored --porcelain=v1 --short --untracked-files=normal | grep '!!' | awk -F ' ' '{print $2}' | sed -e 's#^#'"${GITHUB_WORKSPACE}"/'#' | sort) - debug "GIT_IGNORED_FILES contents: ${GIT_IGNORED_FILES[*]}" - - # Build an associative array to avoid looping throug the ignored files list - local i - declare -g -A GIT_IGNORED_FILES_INDEX - for i in "${!GIT_IGNORED_FILES[@]}"; do - eval GIT_IGNORED_FILES_INDEX["${GIT_IGNORED_FILES[$i]}"]="$i" - done - debug "--- GIT_IGNORED_FILES_INDEX contents ---" - debug "-----------------------" - for i in "${!GIT_IGNORED_FILES_INDEX[@]}"; do - debug "key: $i, value: ${GIT_IGNORED_FILES_INDEX[$i]}" - done - debug "---------------------------------------------" - ######################################### # Check if the Ansible directory exists # ######################################### @@ -316,7 +296,7 @@ function BuildFileList() { ################################################### # Filter files if FILTER_REGEX_EXCLUDE is not set # ################################################### - if [ "${GIT_IGNORED_FILES_INDEX[$FILE]}" ] && [ "${IGNORE_GITIGNORED_FILES}" == "true" ]; then + if git check-ignore "$FILE" && [ "${IGNORE_GITIGNORED_FILES}" == "true" ]; then debug "${FILE} is ignored by Git. Skipping ${FILE}" continue fi