summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--PREUPLOAD.cfg2
-rwxr-xr-xtools/aosp/aosp_sha.sh18
2 files changed, 20 insertions, 0 deletions
diff --git a/PREUPLOAD.cfg b/PREUPLOAD.cfg
index 1f8ab21783ac..07b0ae10fd55 100644
--- a/PREUPLOAD.cfg
+++ b/PREUPLOAD.cfg
@@ -14,3 +14,5 @@ api_lint_hook = ${REPO_ROOT}/frameworks/base/tools/apilint/apilint_sha.sh ${PREU
strings_lint_hook = ${REPO_ROOT}/frameworks/base/tools/stringslint/stringslint_sha.sh ${PREUPLOAD_COMMIT}
hidden_api_txt_hook = ${REPO_ROOT}/frameworks/base/tools/hiddenapi/checksorted_sha.sh ${PREUPLOAD_COMMIT} ${REPO_ROOT}
+
+owners_hook = ${REPO_ROOT}/frameworks/base/tools/aosp/aosp_sha.sh ${PREUPLOAD_COMMIT} "OWNERS$"
diff --git a/tools/aosp/aosp_sha.sh b/tools/aosp/aosp_sha.sh
new file mode 100755
index 000000000000..29bf74c7a8b9
--- /dev/null
+++ b/tools/aosp/aosp_sha.sh
@@ -0,0 +1,18 @@
+#!/bin/bash
+LOCAL_DIR="$( dirname ${BASH_SOURCE} )"
+
+if git branch -vv | grep "^*" | grep "\[aosp/master" > /dev/null; 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
+ echo -e "\033[0;31mThe source of truth for '$file' is in AOSP.\033[0m"
+ echo
+ echo "If your change contains no confidential details, please upload and merge"
+ echo "this change at https://android-review.googlesource.com/."
+ echo
+ exit 77
+ done
+fi