This is an automated email from the ASF dual-hosted git repository.

aw pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/yetus.git


The following commit(s) were added to refs/heads/main by this push:
     new 35af935  YETUS-1127. Rework exclusions. (#223)
35af935 is described below

commit 35af935d99054eb8f30c2cd4d6ba28ae34d085aa
Author: Allen Wittenauer <[email protected]>
AuthorDate: Mon Oct 25 07:02:19 2021 -0700

    YETUS-1127. Rework exclusions. (#223)
---
 .yetus/blanks-eol.txt                              |   1 +
 .yetus/{blanks-eol.txt => excludes.txt}            |   5 +-
 .../precommit/plugins/asflicense.html.md           |   1 +
 .../in-progress/precommit/usage-intro.html.md      |   6 +-
 precommit/src/main/shell/core.d/00-yetuslib.sh     |   4 +-
 precommit/src/main/shell/core.d/01-common.sh       |   2 +
 precommit/src/main/shell/core.d/change-analysis.sh | 105 +++------------------
 precommit/src/main/shell/plugins.d/asflicense.sh   |  29 ++++--
 precommit/src/main/shell/plugins.d/author.sh       |   4 +-
 precommit/src/main/shell/plugins.d/blanks.sh       |   4 +-
 precommit/src/main/shell/plugins.d/buf.sh          |   8 +-
 precommit/src/main/shell/plugins.d/codespell.sh    |   5 -
 precommit/src/main/shell/plugins.d/dupname.sh      |   4 +-
 precommit/src/main/shell/plugins.d/golangci.sh     |   4 +-
 precommit/src/main/shell/test-patch.sh             |  25 +++--
 precommit/src/test/resources/arrayfiletest.txt     |   1 +
 precommit/src/test/resources/brokenfiles/1.txt     |   0
 precommit/src/test/resources/brokenfiles/2.txt     |   0
 precommit/src/test/resources/brokenfiles/3.txt     |   0
 precommit/src/test/resources/brokenfiles/4.txt     |   0
 precommit/src/test/resources/brokenfiles/a1.txt    |   0
 precommit/src/test/resources/brokenfiles/a2.txt    |   0
 precommit/src/test/resources/brokenfiles/a3.txt    |   0
 23 files changed, 74 insertions(+), 134 deletions(-)

diff --git a/.yetus/blanks-eol.txt b/.yetus/blanks-eol.txt
index 18a90de..ae0f698 100644
--- a/.yetus/blanks-eol.txt
+++ b/.yetus/blanks-eol.txt
@@ -14,3 +14,4 @@
 # limitations under the License.
 
 precommit/src/test/resources/blanks.txt
+precommit/src/test/resources/arrayfiletest.txt
diff --git a/.yetus/blanks-eol.txt b/.yetus/excludes.txt
similarity index 79%
copy from .yetus/blanks-eol.txt
copy to .yetus/excludes.txt
index 18a90de..0b24b7a 100644
--- a/.yetus/blanks-eol.txt
+++ b/.yetus/excludes.txt
@@ -13,4 +13,7 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-precommit/src/test/resources/blanks.txt
+precommit/src/test/resources/brokenfiles/1\.txt
+precommit/src/test/resources/brokenfiles/a.*\.txt
+precommit/src/test/resources/brokenfiles/[2-3]\.txt
+^precommit/src/test/resources/brokenfiles/4\.txt
diff --git 
a/asf-site-src/source/documentation/in-progress/precommit/plugins/asflicense.html.md
 
b/asf-site-src/source/documentation/in-progress/precommit/plugins/asflicense.html.md
index 40829b9..f9bca71 100644
--- 
a/asf-site-src/source/documentation/in-progress/precommit/plugins/asflicense.html.md
+++ 
b/asf-site-src/source/documentation/in-progress/precommit/plugins/asflicense.html.md
@@ -40,6 +40,7 @@ None
 | Option | Notes |
 |:---------|:------|
 | `--asflicense-rat-excludes=<path>` | When running rat outside of a build 
tool, specify the location of the exclusion file |
+| `--asflicense-rat-globalexcludes=<bool>` | Apply the global excludes file 
after Apache Rat has run (default: true) |
 | `--asflicense-rat-jar=<path>` | When running rat outside of a build tool, 
specify the location of the Java jar file to execute. Defaults to 
/opt/apache-rat/apache-rat.jar |
 
 # Docker Notes
diff --git 
a/asf-site-src/source/documentation/in-progress/precommit/usage-intro.html.md 
b/asf-site-src/source/documentation/in-progress/precommit/usage-intro.html.md
index b571c47..bbafefe 100644
--- 
a/asf-site-src/source/documentation/in-progress/precommit/usage-intro.html.md
+++ 
b/asf-site-src/source/documentation/in-progress/precommit/usage-intro.html.md
@@ -378,15 +378,15 @@ process the file.patch from the example.com webserver.
 
 Some repositories have content that is either imported from other sources (aka 
"vendored") or in some
 other way have files that are known to break tests. By default, 
`.yetus/excludes.txt` will be read for any
-file, directory, or extended regular expression as the list to remove from 
test results.  The file to read
+file, directory, or regular expression as the list to remove from test 
results.  The file to read
 may be overwritten by using the `--excludes` flag:
 
 ```bash
 $ test-patch --plugins=all --excludes=(filename) (other options)
 ```
 
-    NOTE: for best results, avoid using ^ and $ in your regular expressions.  
`test-patch` will automatically
-    anchor the contents of that file.
+    NOTE: Do not confuse file globs for regular expressions.  With regular 
expressions, `a*` will match `aaaaaaaa`
+    but not `ab`.  To match all characters any number of times, you need `.*` 
as your wildcard expression.
 
 # "Warn-only" Test Results
 
diff --git a/precommit/src/main/shell/core.d/00-yetuslib.sh 
b/precommit/src/main/shell/core.d/00-yetuslib.sh
index 9cb7a2f..d41561f 100755
--- a/precommit/src/main/shell/core.d/00-yetuslib.sh
+++ b/precommit/src/main/shell/core.d/00-yetuslib.sh
@@ -280,11 +280,11 @@ function yetus_file_to_array
     # work due to the variable only being present in
     # the subshell.  So MUST force the grep into the
     # subshell...
-    mapfile -t a < <("${GREP:-grep}" -v -e '^#' -e '^$' "${filename}" )
+    mapfile -t a < <("${GREP:-grep}" -v -E -e '^#' -e '^[[:space:]]*$' 
"${filename}" )
   else
     while read -r line; do
       a+=("${line}")
-    done < <("${GREP:-grep}" -v -e '^#' -e '^$' "${filename}")
+    done < <("${GREP:-grep}" -v -E -e '^#' -e '^[[:space:]]*$' "${filename}")
   fi
   eval "${var}=(\"\${a[@]}\")"
   return 0
diff --git a/precommit/src/main/shell/core.d/01-common.sh 
b/precommit/src/main/shell/core.d/01-common.sh
index 0b74383..4acfedb 100755
--- a/precommit/src/main/shell/core.d/01-common.sh
+++ b/precommit/src/main/shell/core.d/01-common.sh
@@ -31,6 +31,8 @@ function common_defaults
   EXEC_MODES=()
   #shellcheck disable=SC2034
   EXCLUDE_PATHS=()
+  #shellcheck disable=SC2034
+  EXCLUDE_PATHS_FILE='.yetus/excludes.txt'
   IGNORE_UNKNOWN_OPTIONS=false
   ROBOTTYPE=""
   LOAD_SYSTEM_PLUGINS=true
diff --git a/precommit/src/main/shell/core.d/change-analysis.sh 
b/precommit/src/main/shell/core.d/change-analysis.sh
index 079c5f2..d75cdb1 100755
--- a/precommit/src/main/shell/core.d/change-analysis.sh
+++ b/precommit/src/main/shell/core.d/change-analysis.sh
@@ -56,6 +56,7 @@ function find_changed_files
   INPUT_APPLIED_FILE=${INPUT_APPLIED_FILE:-${PATCH_DIR}/patch}
 
   pushd "${BASEDIR}" >/dev/null || return 1
+  CHANGED_FILES=()
 
   case "${BUILDMODE}" in
     full)
@@ -79,64 +80,10 @@ function find_changed_files
       ;;
     esac
   popd >/dev/null || return 1
+  CHANGED_FILES_COMPLETE=("${CHANGED_FILES[@]}")
 }
 
 
-## @description Determine directories with
-## @description changed content. Should be used with
-## @description static linters that don't care about
-## @description the build system.
-## @audience    private
-## @stability   evolving
-## @replaceable no
-## @return      None; sets ${CHANGED_DIRS}
-function find_changed_dirs
-{
-  declare f
-  declare -a newarray
-  declare dir
-
-  CHANGED_DIRS=()
-  for f in "${CHANGED_FILES[@]}"; do
-    dir=$(dirname "./${f}")
-    if [[ "${dir}" = . ]]; then
-      CHANGED_DIRS=('.')
-      continue
-    fi
-    yetus_add_array_element CHANGED_DIRS "${dir}"
-  done
-
-  if [[ "${#CHANGED_DIRS[@]}" -eq 1 ]]; then
-    return
-  fi
-
-  echo "${#CHANGED_DIRS[@]}"
-
-  newarray=()
-
-  for f in "${CHANGED_DIRS[@]}"; do
-    dir=${f%/*}
-    found=false
-    while [[ ${dir} != "." ]] && [[ ${found} = false ]]; do
-      if yetus_array_contains "${dir}" "${newarray[@]}"; then
-        found=true
-        continue
-      fi
-      if yetus_array_contains "${dir}" "${CHANGED_DIRS[@]}"; then
-        found=true
-        continue
-      fi
-      dir=${dir%/*}
-    done
-
-    if [[ "${found}" == false ]]; then
-      newarray+=("${f}")
-    fi
-  done
-
-  CHANGED_DIRS=("${newarray[@]}")
-}
-
 ## @description  Apply the EXCLUDE_PATHS to CHANGED_FILES
 ## @audience     private
 ## @stability    stable
@@ -151,50 +98,28 @@ function exclude_paths_from_changed_files
 
   # empty the existing list
   EXCLUDE_PATHS=()
+  if [[ -f "${PATCH_DIR}/excluded.txt" ]]; then
+    mv "${PATCH_DIR}/excluded.txt" "${PATCH_DIR}/branch-excluded.txt"
+  fi
 
-  # if E_P_F has been defined, then it was found earlier
-  if [[ -n "${EXCLUDE_PATHS_FILE}" ]]; then
-
-    # if it still exists ( it may have gotten deleted post-patch!)
-    # read it in
-    if [[ -f "${EXCLUDE_PATHS_FILE}" ]]; then
-      yetus_file_to_array EXCLUDE_PATHS "${EXCLUDE_PATHS_FILE}"
-    else
-      # it was deleted post-patch, so delete it
-      unset EXCLUDE_PATHS_FILE
-      return
-    fi
-
- # User provided us with a name but it wasn't there.
- # let's see if it is now
- elif [[ -n "${EXCLUDE_PATHS_FILE_SAVEOFF}" ]]; then
-    # try to absolute the file name
-    if [[ -f "${EXCLUDE_PATHS_FILE_SAVEOFF}" ]]; then
-      EXCLUDE_PATHS_FILE=$(yetus_abs "${EXCLUDE_PATHS_FILE_SAVEOFF}")
-    elif [[ -f "${BASEDIR}/${EXCLUDE_PATHS_FILE_SAVEOFF}" ]]; then
-      EXCLUDE_PATHS_FILE=$(yetus_abs 
"${BASEDIR}/${EXCLUDE_PATHS_FILE_SAVEOFF}")
-    fi
-
-    # if it exists, process, otherwise just return because nothing
-    # to do
-
-    if [[ -f "${EXCLUDE_PATHS_FILE}" ]]; then
-      yetus_file_to_array EXCLUDE_PATHS "${EXCLUDE_PATHS_FILE}"
-    else
-      unset EXCLUDE_PATHS_FILE
-      return
-    fi
-  else
+  if [[ ! -f "${EXCLUDE_PATHS_FILE}" ]]; then
+    # it was deleted post-patch, so ignore it
+    CHANGED_FILES=("${CHANGED_FILES_COMPLETE[@]}")
     return
   fi
 
+  # it still exists ( it may have gotten deleted post-patch!)
+  # read it in
+  yetus_file_to_array EXCLUDE_PATHS "${EXCLUDE_PATHS_FILE}"
+
   a=()
-  for f in "${CHANGED_FILES[@]}"; do
+  for f in "${CHANGED_FILES_COMPLETE[@]}"; do
     strip=false
     for p in "${EXCLUDE_PATHS[@]}"; do
-      if [[  "${f}" =~ ${p} ]]; then
+      if [[ "${f}" =~ ${p} ]]; then
         strip=true
         echo "${f}" >> "${PATCH_DIR}/excluded.txt"
+        break
       fi
     done
     if [[ ${strip} = false ]]; then
diff --git a/precommit/src/main/shell/plugins.d/asflicense.sh 
b/precommit/src/main/shell/plugins.d/asflicense.sh
index 4d5a4e2..d8748b9 100755
--- a/precommit/src/main/shell/plugins.d/asflicense.sh
+++ b/precommit/src/main/shell/plugins.d/asflicense.sh
@@ -19,11 +19,13 @@
 add_test_type asflicense
 
 ASFLICENSE_RAT_JAR=/opt/apache-rat/apache-rat.jar
+ASFLICENSE_RAT_GLOBALEXCLUDES=true
 
 function asflicense_usage
 {
-  yetus_add_option "--asflicense-rat-excludes=<file>" "path to file containing 
exclusion patterns"
-  yetus_add_option "--asflicense-rat-jar=<file>" "path to Apache Creadur Rat 
jar file"
+  yetus_add_option "--asflicense-rat-excludes=<file>" "Path to file containing 
exclusion patterns"
+  yetus_add_option "--asflicense-rat-globalexcludes=<bool>" "Filter against 
global exclusion patterns (default: ${ASFLICENSE_RAT_GLOBALEXCLUDES})"
+  yetus_add_option "--asflicense-rat-jar=<file>" "Path to Apache Creadur Rat 
jar file"
 }
 
 function asflicense_parse_args
@@ -36,6 +38,10 @@ function asflicense_parse_args
         delete_parameter "${i}"
         ASFLICENSE_RAT_EXCLUDES=${i#*=}
       ;;
+      --asflicense-rat-globalexcludes=*)
+        delete_parameter "${i}"
+        ASFLICENSE_RAT_GLOBALEXCLUDES=${i#*=}
+      ;;
       --asflicense-rat-jar=*)
         delete_parameter "${i}"
         ASFLICENSE_RAT_JAR=${i#*=}
@@ -95,7 +101,7 @@ function asflicense_tests
       btfails=false
       asflicense_writexsl "${PATCH_DIR}/asf.xsl"
       if [[ -f ${ASFLICENSE_RAT_EXCLUDES} ]]; then
-        echo_and_redirect "${PATCH_DIR}/patch-asflicense.txt" \
+        echo_and_redirect "${PATCH_DIR}/patch-asflicense-raw.txt" \
         "${JAVA_HOME}/bin/java" \
             -jar "${ASFLICENSE_RAT_JAR}" \
             -s "${PATCH_DIR}/asf.xsl" \
@@ -103,7 +109,7 @@ function asflicense_tests
             -d "${BASEDIR}"
         retval=$?
       else
-        echo_and_redirect "${PATCH_DIR}/patch-asflicense.txt" \
+        echo_and_redirect "${PATCH_DIR}/patch-asflicense-raw.txt" \
         "${JAVA_HOME}/bin/java" \
             -jar "${ASFLICENSE_RAT_JAR}" \
             -s "${PATCH_DIR}/asf.xsl" \
@@ -120,15 +126,15 @@ function asflicense_tests
     return 0
   fi
 
-  if [[ ! -f "${PATCH_DIR}/patch-asflicense.txt" ]]; then
+  if [[ ! -f "${PATCH_DIR}/patch-asflicense-raw.txt" ]]; then
     #shellcheck disable=SC2038
     find "${BASEDIR}" -name rat.txt \
           -o -name releaseaudit_report.txt \
           -o -name rat-report.txt \
-      | xargs cat > "${PATCH_DIR}/patch-asflicense.txt"
+      | xargs cat > "${PATCH_DIR}/patch-asflicense-raw.txt"
   fi
 
-  if [[ ! -s "${PATCH_DIR}/patch-asflicense.txt" ]]; then
+  if [[ ! -s "${PATCH_DIR}/patch-asflicense-raw.txt" ]]; then
     if [[ ${btfails} = true ]]; then
       # if we're here, then build actually failed
       modules_messages patch asflicense true
@@ -139,6 +145,15 @@ function asflicense_tests
     fi
   fi
 
+  if [[ -f "${PATCH_DIR}/excluded.txt" && "${ASFLICENSE_RAT_GLOBALEXCLUDES}" 
== "true"  ]]; then
+    "${GREP}" "-v" \
+      "-f" "${PATCH_DIR}/excluded.txt" \
+      "${PATCH_DIR}/patch-asflicense-raw.txt" \
+      > "${PATCH_DIR}/patch-asflicense.txt"
+  else
+    cp -p "${PATCH_DIR}/patch-asflicense-raw.txt" 
"${PATCH_DIR}/patch-asflicense.txt"
+  fi
+
   numpatch=$("${GREP}" -c '\!?????' "${PATCH_DIR}/patch-asflicense.txt")
   echo ""
   echo ""
diff --git a/precommit/src/main/shell/plugins.d/author.sh 
b/precommit/src/main/shell/plugins.d/author.sh
index 2e9ea37..3a98eca 100755
--- a/precommit/src/main/shell/plugins.d/author.sh
+++ b/precommit/src/main/shell/plugins.d/author.sh
@@ -133,8 +133,8 @@ function author_postcompile
 
   start_clock
 
-  if [[ -n "${EXCLUDE_PATHS_FILE}" ]] && [[ -f "${EXCLUDE_PATHS_FILE}" ]]; then
-    globalignore=("${GREP}" "-v" "-E" "-f" "${EXCLUDE_PATHS_FILE}")
+  if [[ -f "${PATCH_DIR}/excluded.txt" ]]; then
+    globalignore=("${GREP}" "-v" "-f" "${PATCH_DIR}/excluded.txt")
   else
     globalignore=("cat")
   fi
diff --git a/precommit/src/main/shell/plugins.d/blanks.sh 
b/precommit/src/main/shell/plugins.d/blanks.sh
index 3865eaf..595c329 100755
--- a/precommit/src/main/shell/plugins.d/blanks.sh
+++ b/precommit/src/main/shell/plugins.d/blanks.sh
@@ -132,8 +132,8 @@ function blanks_postcompile
     tabsignore=("cat")
   fi
 
-  if [[ -n "${EXCLUDE_PATHS_FILE}" ]]; then
-    globalignore=("${GREP}" "-v" "-E" "-f" "${EXCLUDE_PATHS_FILE}")
+  if [[ -f "${PATCH_DIR}/excluded.txt" ]]; then
+    globalignore=("${GREP}" "-v" "-f" "${PATCH_DIR}/excluded.txt")
   else
     globalignore=("cat")
   fi
diff --git a/precommit/src/main/shell/plugins.d/buf.sh 
b/precommit/src/main/shell/plugins.d/buf.sh
index 195b5f8..57dc526 100755
--- a/precommit/src/main/shell/plugins.d/buf.sh
+++ b/precommit/src/main/shell/plugins.d/buf.sh
@@ -132,8 +132,8 @@ function bufcompat_executor
   offset_clock "${BUFCOMPAT_TIMER}"
 
   echo "Running buf against identified protobuf files."
-  if [[ -n "${EXCLUDE_PATHS_FILE}" ]] && [[ -f "${EXCLUDE_PATHS_FILE}" ]]; then
-    args=("${GREP}" "-v" "-E" "-f" "${EXCLUDE_PATHS_FILE}")
+  if [[ -f "${PATCH_DIR}/excluded.txt" ]]; then
+    args=("${GREP}" "-v" "-f" "${PATCH_DIR}/excluded.txt")
   else
     args=("cat")
   fi
@@ -257,8 +257,8 @@ function buflint_executor
   offset_clock "${BUFLINT_TIMER}"
 
   echo "Running buf against identified protobuf files."
-  if [[ -n "${EXCLUDE_PATHS_FILE}" ]] && [[ -f "${EXCLUDE_PATHS_FILE}" ]]; then
-    args=("${GREP}" "-v" "-E" "-f" "${EXCLUDE_PATHS_FILE}")
+  if [[ -f "${PATCH_DIR}/excluded.txt" ]]; then
+    args=("${GREP}" "-v" "-f" "${PATCH_DIR}/excluded.txt")
   else
     args=("cat")
   fi
diff --git a/precommit/src/main/shell/plugins.d/codespell.sh 
b/precommit/src/main/shell/plugins.d/codespell.sh
index fd2b547..c267ae2 100755
--- a/precommit/src/main/shell/plugins.d/codespell.sh
+++ b/precommit/src/main/shell/plugins.d/codespell.sh
@@ -69,11 +69,6 @@ function codespell_logic
 
   pushd "${BASEDIR}" >/dev/null || return 1
 
-  # codespell will ignore skip directives if you give it
-  # a specific file name.  so best we can do is
-  # use CHANGED_DIRS[@].  Will still need to filter out
-  # files, but this should at least cut back on the runtime
-
   if [[ -f "${CODESPELL_X_FILE}" ]]; then
     codespellargs=("--exclude-file" "${CODESPELL_X_FILE}")
   fi
diff --git a/precommit/src/main/shell/plugins.d/dupname.sh 
b/precommit/src/main/shell/plugins.d/dupname.sh
index db93791..189f59a 100755
--- a/precommit/src/main/shell/plugins.d/dupname.sh
+++ b/precommit/src/main/shell/plugins.d/dupname.sh
@@ -70,7 +70,7 @@ function dupname_precheck
   declare prev
   declare -a tmpfiles
 
-  tmpfiles=("${CHANGED_FILES[@]}")
+  tmpfiles=("${CHANGED_FILES_COMPLETE[@]}")
 
   big_console_header "Checking for duplicated filenames that differ only in 
case"
   start_clock
@@ -78,7 +78,7 @@ function dupname_precheck
   pushd "${BASEDIR}" >/dev/null || return 1
 
   # check the existing tree
-  for fn in "${CHANGED_FILES[@]}"; do
+  for fn in "${CHANGED_FILES_COMPLETE[@]}"; do
     existing=$(${GIT} ls-files ":(icase)${fn}")
     if [[ -n "${existing}" ]]; then
       if [[ "${existing}" != "${fn}" ]]; then
diff --git a/precommit/src/main/shell/plugins.d/golangci.sh 
b/precommit/src/main/shell/plugins.d/golangci.sh
index 9d9ef47..458a1d6 100755
--- a/precommit/src/main/shell/plugins.d/golangci.sh
+++ b/precommit/src/main/shell/plugins.d/golangci.sh
@@ -77,8 +77,8 @@ function golangcilint_exec
   declare -a args
   declare -a gargs
 
-  if [[ -f "${EXCLUDE_PATHS_FILE}" ]]; then
-    gargs=("${GREP}" "-v" "-E" "-f" "${EXCLUDE_PATHS_FILE}")
+  if [[ -f "${PATCH_DIR}/excluded.txt" ]]; then
+    gargs=("${GREP}" "-v" "-f" "${PATCH_DIR}/excluded.txt")
   else
     gargs=("cat")
   fi
diff --git a/precommit/src/main/shell/test-patch.sh 
b/precommit/src/main/shell/test-patch.sh
index 01b3283..d316c29 100755
--- a/precommit/src/main/shell/test-patch.sh
+++ b/precommit/src/main/shell/test-patch.sh
@@ -1010,14 +1010,14 @@ function parse_args
   PATCH_DIR=$(yetus_abs "${PATCH_DIR}")
   COPROC_LOGFILE="${PATCH_DIR}/coprocessors.txt"
 
-  if [[ -n "${EXCLUDE_PATHS_FILE}" ]]; then
-    # shellcheck disable=SC2034
-    EXCLUDE_PATHS_FILE_SAVEOFF=${EXCLUDE_PATHS_FILE}
-    if [[ -f "${EXCLUDE_PATHS_FILE}" ]]; then
-      EXCLUDE_PATHS_FILE=$(yetus_abs "${EXCLUDE_PATHS_FILE}")
-    elif [[ -f "${BASEDIR}/${EXCLUDE_PATHS_FILE}" ]]; then
-      EXCLUDE_PATHS_FILE=$(yetus_abs "${BASEDIR}/${EXCLUDE_PATHS_FILE}")
-    fi
+  if [[ -f "${EXCLUDE_PATHS_FILE}" ]]; then
+    EXCLUDE_PATHS_FILE=$(yetus_abs "${EXCLUDE_PATHS_FILE}")
+  elif [[ -f "${BASEDIR}/${EXCLUDE_PATHS_FILE}" ]]; then
+    EXCLUDE_PATHS_FILE=$(yetus_abs "${BASEDIR}/${EXCLUDE_PATHS_FILE}")
+  fi
+
+  if [[ -f "${EXCLUDE_PATHS_FILE}" ]]; then
+    EXCLUDE_PATHS_FILE=$(yetus_relative_dir "${BASEDIR}" 
"${EXCLUDE_PATHS_FILE}")
   fi
 
   # we need absolute dir for ${CONSOLE_REPORT_FILE}
@@ -1409,7 +1409,7 @@ function determine_needed_tests
   big_console_header "Determining needed tests"
   echo "(Depending upon input size and number of plug-ins, this may take a 
while)"
 
-  exclude_paths_from_changed_files
+  exclude_paths_from_changed_files "branch"
 
   for i in "${CHANGED_FILES[@]}"; do
     yetus_debug "Determining needed tests for ${i}"
@@ -1498,11 +1498,6 @@ function copytpbits
   # Set to be relative to ${PATCH_DIR}/precommit
   USER_PLUGIN_DIR="${PATCH_DIR}/precommit/user-plugins"
 
-  if [[ -n ${EXCLUDE_PATHS_FILE}
-    && -f ${EXCLUDE_PATHS_FILE} ]]; then
-    yetus_debug "copying '${EXCLUDE_PATHS_FILE}' over to 
'${PATCH_DIR}/precommit/excluded.txt'"
-    cp -pr "${EXCLUDE_PATHS_FILE}" "${PATCH_DIR}/precommit/excluded.txt"
-  fi
   if [[ -n ${PERSONALITY}
     && -f ${PERSONALITY} ]]; then
     yetus_debug "copying '${PERSONALITY}' over to 
'${PATCH_DIR}/precommit/personality/provided.sh'"
@@ -3304,6 +3299,8 @@ if [[ "${BUILDMODE}" = patch ]]; then
 
   apply_patch_file
 
+  # Need to re-analyze the what files are changed due to
+  # potentially new exclusion rules
   exclude_paths_from_changed_files
 
   compute_gitdiff
diff --git a/precommit/src/test/resources/arrayfiletest.txt 
b/precommit/src/test/resources/arrayfiletest.txt
index 3ffd070..d3dd687 100644
--- a/precommit/src/test/resources/arrayfiletest.txt
+++ b/precommit/src/test/resources/arrayfiletest.txt
@@ -1,5 +1,6 @@
 1
 2
+ 
 3
 
 # Licensed to the Apache Software Foundation (ASF) under one or more
diff --git a/precommit/src/test/resources/brokenfiles/1.txt 
b/precommit/src/test/resources/brokenfiles/1.txt
new file mode 100644
index 0000000..e69de29
diff --git a/precommit/src/test/resources/brokenfiles/2.txt 
b/precommit/src/test/resources/brokenfiles/2.txt
new file mode 100644
index 0000000..e69de29
diff --git a/precommit/src/test/resources/brokenfiles/3.txt 
b/precommit/src/test/resources/brokenfiles/3.txt
new file mode 100644
index 0000000..e69de29
diff --git a/precommit/src/test/resources/brokenfiles/4.txt 
b/precommit/src/test/resources/brokenfiles/4.txt
new file mode 100644
index 0000000..e69de29
diff --git a/precommit/src/test/resources/brokenfiles/a1.txt 
b/precommit/src/test/resources/brokenfiles/a1.txt
new file mode 100644
index 0000000..e69de29
diff --git a/precommit/src/test/resources/brokenfiles/a2.txt 
b/precommit/src/test/resources/brokenfiles/a2.txt
new file mode 100644
index 0000000..e69de29
diff --git a/precommit/src/test/resources/brokenfiles/a3.txt 
b/precommit/src/test/resources/brokenfiles/a3.txt
new file mode 100644
index 0000000..e69de29

Reply via email to