1#!/bin/bash 2LOCAL_DIR="$( dirname "${BASH_SOURCE}" )" 3 4if git branch -vv | grep -q -P "^\*[^\[]+\[aosp/"; then 5 # Change appears to be in AOSP 6 exit 0 7elif git log -n 1 --format='%B' $1 | grep -q -E "^Ignore-AOSP-First: .+" ; then 8 # Change is explicitly marked as ok to skip AOSP 9 exit 0 10else 11 # Change appears to be non-AOSP; search for files 12 count=0 13 while read -r file ; do 14 if (( count == 0 )); then 15 echo 16 fi 17 echo -e "\033[0;31;47mThe source of truth for '$file' is in AOSP.\033[0m" 18 (( count++ )) 19 done < <(git show --name-only --pretty=format: $1 | grep -- "$2") 20 if (( count != 0 )); then 21 echo 22 echo "If your change contains no confidential details (such as security fixes), please" 23 echo "upload and merge this change at https://android-review.googlesource.com/." 24 echo 25 exit 1 26 fi 27fi 28