From 72dad8a9d12b7e74c75a5d7b98229fcd216eb283 Mon Sep 17 00:00:00 2001 From: Yury Khmel Date: Tue, 14 Jul 2020 23:44:46 -0700 Subject: [PATCH] Fix presubmit for hidden api. grep returns 1 for if nothing was found. This fails presubmit hook due to bash handling "set -e" Looks like grep not found is valid case. This fixes this issue by bypassing grep exit code. Test: Locally Bug: 161351699 Merged-In: I39e926a348a0fb8f4040f86034affdb4204faac5 Change-Id: I39e926a348a0fb8f4040f86034affdb4204faac5 (cherry picked from commit e6a5253f1262acce5d8156867ffddc276a706c3d) --- tools/hiddenapi/exclude.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/hiddenapi/exclude.sh b/tools/hiddenapi/exclude.sh index 18c40546fd024..73eacc0641e5d 100755 --- a/tools/hiddenapi/exclude.sh +++ b/tools/hiddenapi/exclude.sh @@ -35,7 +35,7 @@ TEAMS=LIBCORE PACKAGES=$(for t in $TEAMS; do echo $(eval echo \${${t}_PACKAGES}); done) RE=$(echo ${PACKAGES} | sed "s/ /|/g") git show --name-only --pretty=format: $1 | grep "config/hiddenapi-.*txt" | while read file; do - ENTRIES=$(grep -E "^L(${RE})/" <(git show $1:$file)) + ENTRIES=$(grep -E "^L(${RE})/" || true <(git show $1:$file)) if [[ -n "${ENTRIES}" ]]; then echo -e "\e[1m\e[31m$file $1 contains the following entries\e[0m" echo -e "\e[1m\e[31mfor packages that are handled using UnsupportedAppUsage. Please remove\e[0m"