yetus-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a.@apache.org
Subject [2/2] yetus git commit: YETUS-385. test plugin for author tag detection should have a way to opt-out of specific instances
Date Tue, 19 Apr 2016 23:10:47 GMT
YETUS-385. test plugin for author tag detection should have a way to opt-out of specific instances

Signed-off-by: Allen Wittenauer <aw@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/yetus/repo
Commit: http://git-wip-us.apache.org/repos/asf/yetus/commit/3f782d34
Tree: http://git-wip-us.apache.org/repos/asf/yetus/tree/3f782d34
Diff: http://git-wip-us.apache.org/repos/asf/yetus/diff/3f782d34

Branch: refs/heads/YETUS-156
Commit: 3f782d3460fbfa9f01de96b22e1e843b8851d240
Parents: 088070a
Author: Allen Wittenauer <aw@apache.org>
Authored: Mon Apr 18 13:40:37 2016 -0700
Committer: Allen Wittenauer <aw@apache.org>
Committed: Tue Apr 19 16:10:00 2016 -0700

----------------------------------------------------------------------
 precommit/test-patch.d/author.sh | 43 ++++++++++++++++++++++++++++++++---
 1 file changed, 40 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/yetus/blob/3f782d34/precommit/test-patch.d/author.sh
----------------------------------------------------------------------
diff --git a/precommit/test-patch.d/author.sh b/precommit/test-patch.d/author.sh
index 0e00c80..dccd504 100755
--- a/precommit/test-patch.d/author.sh
+++ b/precommit/test-patch.d/author.sh
@@ -16,6 +16,32 @@
 
 add_test_type author
 
+## @description  author usage hook
+## @audience     private
+## @stability    evolving
+## @replaceable  no
+function author_usage
+{
+  yetus_add_option "--author-ignore-list=<list>" "list of filenames to ignore (full
build mode only)"
+}
+
+## @description  author parse args hook
+## @audience     private
+## @stability    evolving
+## @replaceable  no
+function author_parse_args
+{
+  declare i
+
+  for i in "$@"; do
+    case ${i} in
+      --author-ignore-list=*)
+        yetus_comma_to_array AUTHOR_IGNORE_LIST "${i#*=}"
+      ;;
+    esac
+  done
+}
+
 ## @description  helper function for @author tags check
 ## @audience     private
 ## @stability    evolving
@@ -93,7 +119,7 @@ function author_postcompile
 {
   # shellcheck disable=SC2155
   declare -r appname=$(basename "${BASH_SOURCE-$0}")
-  declare i
+  declare fn
 
   if [[ "${BUILDMODE}" != full ]]; then
     return
@@ -103,9 +129,20 @@ function author_postcompile
 
   start_clock
 
-  "${GIT}" grep -n -I --extended-regexp -i '^[^-].*@author' \
+  "${GIT}" grep -n -I --extended-regexp -i -e '^[^-].*@author' \
     | ${GREP} -v "${appname}" \
-    >> "${PATCH_DIR}/author-tags.txt"
+    >> "${PATCH_DIR}/author-tags-git.txt"
+
+  if [[ -z "${AUTHOR_IGNORE_LIST[0]}" ]]; then
+    cp -p "${PATCH_DIR}/author-tags-git.txt" "${PATCH_DIR}/author-tags.txt"
+  else
+    cp -p "${PATCH_DIR}/author-tags-git.txt" "${PATCH_DIR}/author-tags.1"
+    for fn in "${AUTHOR_IGNORE_LIST[@]}"; do
+      ${GREP} -v -E "^${fn}" "${PATCH_DIR}/author-tags.1" >> "${PATCH_DIR}/author-tags.2"
+      mv "${PATCH_DIR}/author-tags.2" "${PATCH_DIR}/author-tags.1"
+    done
+    mv "${PATCH_DIR}/author-tags.1" "${PATCH_DIR}/author-tags.txt"
+  fi
 
   author_generic
 }


Mime
View raw message