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

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


The following commit(s) were added to refs/heads/master by this push:
     new 79eadbd  YETUS-949. remove empty filenames in find_changed_files (#96)
79eadbd is described below

commit 79eadbd10e7e6db800a5eb61724e1d7439f08ae0
Author: Allen Wittenauer <[email protected]>
AuthorDate: Thu Mar 5 06:18:50 2020 -0800

    YETUS-949. remove empty filenames in find_changed_files (#96)
---
 precommit/src/main/shell/core.d/change-analysis.sh | 7 +++++--
 precommit/src/main/shell/core.d/patchfiles.sh      | 3 ++-
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/precommit/src/main/shell/core.d/change-analysis.sh 
b/precommit/src/main/shell/core.d/change-analysis.sh
index d1ac42a..83a99c5 100755
--- a/precommit/src/main/shell/core.d/change-analysis.sh
+++ b/precommit/src/main/shell/core.d/change-analysis.sh
@@ -66,11 +66,14 @@ function find_changed_files
       # get a list of all of the files that have been changed,
       # except for /dev/null (which would be present for new files).
       # Additionally, remove any a/ b/ patterns at the front of the patch 
filenames.
+      # see also similar code in change-analysis
       # shellcheck disable=SC2016
       while read -r line; do
-        CHANGED_FILES=("${CHANGED_FILES[@]}" "${line}")
+        if [[ -n "${line}" ]]; then
+          CHANGED_FILES=("${CHANGED_FILES[@]}" "${line}")
+        fi
       done < <(
-        "${AWK}" 'function p(s){sub("^[ab]/","",s); if(s!~"^/dev/null"){print 
s}}
+        "${AWK}" 'function p(s){sub("^[ab]/","",s); 
if(s!~"^/dev/null"&&s!~"^[[:blank:]]*$"){print s}}
         /^diff --git /   { p($3); p($4) }
         /^(\+\+\+|---) / { p($2) }' "${INPUT_APPLIED_FILE}" | sort -u)
       ;;
diff --git a/precommit/src/main/shell/core.d/patchfiles.sh 
b/precommit/src/main/shell/core.d/patchfiles.sh
index dbed125..8824f56 100755
--- a/precommit/src/main/shell/core.d/patchfiles.sh
+++ b/precommit/src/main/shell/core.d/patchfiles.sh
@@ -205,8 +205,9 @@ function patchfile_verify_zero
   declare filename
 
   # don't return /dev/null
+  # see also similar code in change-analysis
   # shellcheck disable=SC2016
-  changed_files1=$("${AWK}" 'function p(s){if(s!~"^/dev/null"){print s}}
+  changed_files1=$("${AWK}" 'function 
p(s){if(s!~"^/dev/null"&&s!~"^[[:blank:]]*$"){print s}}
     /^diff --git /   { p($3); p($4) }
     /^(\+\+\+|---) / { p($2) }' "${INPUT_PATCH_FILE}" | sort -u)
 

Reply via email to