blob: 81d35efaf29f98519bd6432459983c6f171dc56e [file] [log] [blame]
Jeff Sharkey0a9c7312018-08-23 22:01:53 -06001#!/bin/bash
Jeff Sharkey5b471992018-09-11 10:36:57 -06002LOCAL_DIR="$( dirname "${BASH_SOURCE}" )"
Jeff Sharkey0a9c7312018-08-23 22:01:53 -06003
Jeff Sharkey5b471992018-09-11 10:36:57 -06004if git branch -vv | grep -q -P "^\*[^\[]+\[aosp/"; then
Jeff Sharkey0a9c7312018-08-23 22:01:53 -06005 # Change appears to be in AOSP
6 exit 0
Seth Moore627b9ca2021-05-24 13:43:35 -07007elif 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
Jeff Sharkey0a9c7312018-08-23 22:01:53 -060010else
11 # Change appears to be non-AOSP; search for files
Jeff Sharkey5b471992018-09-11 10:36:57 -060012 count=0
13 while read -r file ; do
14 if (( count == 0 )); then
15 echo
16 fi
Alan Stokes293096a2020-07-28 18:19:20 +010017 echo -e "\033[0;31;47mThe source of truth for '$file' is in AOSP.\033[0m"
Jeff Sharkey5b471992018-09-11 10:36:57 -060018 (( count++ ))
19 done < <(git show --name-only --pretty=format: $1 | grep -- "$2")
20 if (( count != 0 )); then
Jeff Sharkey0a9c7312018-08-23 22:01:53 -060021 echo
Jeff Sharkey5b471992018-09-11 10:36:57 -060022 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/."
Jeff Sharkey0a9c7312018-08-23 22:01:53 -060024 echo
Jeff Sharkeyaaaf1b72018-12-03 10:56:56 -070025 exit 1
Jeff Sharkey5b471992018-09-11 10:36:57 -060026 fi
Jeff Sharkey0a9c7312018-08-23 22:01:53 -060027fi