Find ignore directory using ls-files (#6676)
author오형석/On-Device Lab(SR)/Staff Engineer/삼성전자 <hseok82.oh@samsung.com>
Mon, 19 Aug 2019 08:02:18 +0000 (17:02 +0900)
committerGitHub Enterprise <noreply-CODE@samsung.com>
Mon, 19 Aug 2019 08:02:18 +0000 (17:02 +0900)
Instead of using find command, use git ls-files to find .FORMATDENY file to make format check ignore directory list

Signed-off-by: Hyeongseok Oh <hseok82.oh@samsung.com>
infra/command/format

index a7304e2..c850b41 100644 (file)
@@ -91,8 +91,7 @@ function check_cpp_files() {
 
   # Skip by '.FORMATDENY' file
   for s in ${DIRECTORIES_NOT_TO_BE_TESTED[@]}; do
-    skip=${s#'.'/}/
-    FILES_TO_CHECK_CPP=(${FILES_TO_CHECK_CPP[*]/$skip*/})
+    FILES_TO_CHECK_CPP=(${FILES_TO_CHECK_CPP[*]/$s*/})
   done
 
   if [[ ${#FILES_TO_CHECK_CPP} -ne 0 ]]; then
@@ -162,8 +161,8 @@ if [[ "${CHECK_DIFF_ONLY}" = "1" ]]; then
   fi
 fi
 
-for DIR_NOT_TO_BE_TESTED in $(find -name '.FORMATDENY' -exec dirname {} \;); do
-  DIRECTORIES_NOT_TO_BE_TESTED+=("${DIR_NOT_TO_BE_TESTED}")
+for DIR_NOT_TO_BE_TESTED in $(git ls-files '*/.FORMATDENY'); do
+  DIRECTORIES_NOT_TO_BE_TESTED+=($(dirname "${DIR_NOT_TO_BE_TESTED}"))
 done
 
 check_newline