diff options
author | Jeff Sharkey <jsharkey@android.com> | 2018-09-11 10:36:57 -0600 |
---|---|---|
committer | Jeff Sharkey <jsharkey@android.com> | 2018-09-11 12:14:48 -0600 |
commit | 5b471996ebebce503487ca08c86ee7eb62e6dd3d (patch) | |
tree | dadd7f10e7220be3bace09dae9d3707bf37dd003 | |
parent | 0a9c731969fe590f82a5a4e34f9f1470d57d20b2 (diff) |
Tweaks to AOSP upload hook logic.
Lists all matching files, and slightly more robust path handling.
Bug: 113136846
Test: manual
Change-Id: Ic1971a3df97b8b137993b5856b47d0d706a996cd
-rwxr-xr-x | tools/aosp/aosp_sha.sh | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/tools/aosp/aosp_sha.sh b/tools/aosp/aosp_sha.sh index 29bf74c7a8b9..e50c70d0656a 100755 --- a/tools/aosp/aosp_sha.sh +++ b/tools/aosp/aosp_sha.sh @@ -1,18 +1,24 @@ #!/bin/bash -LOCAL_DIR="$( dirname ${BASH_SOURCE} )" +LOCAL_DIR="$( dirname "${BASH_SOURCE}" )" -if git branch -vv | grep "^*" | grep "\[aosp/master" > /dev/null; then +if git branch -vv | grep -q -P "^\*[^\[]+\[aosp/"; then # Change appears to be in AOSP exit 0 else # Change appears to be non-AOSP; search for files - git show --name-only --pretty=format: $1 | grep $2 | while read file; do - echo + count=0 + while read -r file ; do + if (( count == 0 )); then + echo + fi echo -e "\033[0;31mThe source of truth for '$file' is in AOSP.\033[0m" + (( count++ )) + done < <(git show --name-only --pretty=format: $1 | grep -- "$2") + if (( count != 0 )); then echo - echo "If your change contains no confidential details, please upload and merge" - echo "this change at https://android-review.googlesource.com/." + echo "If your change contains no confidential details (such as security fixes), please" + echo "upload and merge this change at https://android-review.googlesource.com/." echo exit 77 - done + fi fi |