diff options
| author | 2018-08-23 22:01:53 -0600 | |
|---|---|---|
| committer | 2018-08-23 22:24:03 -0600 | |
| commit | fb7b3732c1bccdef8152f7572d4bf8747414ce13 (patch) | |
| tree | 249d065f9e3704a4787a2530ea6fba7f261d891e | |
| parent | be3a75cb550f9a009cbcd40242923e2659a6ac70 (diff) | |
Upload hook that guides people towards AOSP.
The canonical location of certain parts of the source tree live in
AOSP, and should not be changed internally to avoid merge conflicts.
This initially starts with "OWNERS" files, but the hook can easily
be repeated to match any files based on file path regexes.
Bug: 113136846
Test: manual
Change-Id: I113e63b6133f20389d84ec0d6d8b81cdbdf35d38
| -rw-r--r-- | PREUPLOAD.cfg | 2 | ||||
| -rwxr-xr-x | tools/aosp/aosp_sha.sh | 18 |
2 files changed, 20 insertions, 0 deletions
diff --git a/PREUPLOAD.cfg b/PREUPLOAD.cfg index fbbc2a3d9dc4..de83f3e01074 100644 --- a/PREUPLOAD.cfg +++ b/PREUPLOAD.cfg @@ -17,3 +17,5 @@ strings_lint_hook = ${REPO_ROOT}/frameworks/base/tools/stringslint/stringslint_s hidden_api_txt_hook = ${REPO_ROOT}/frameworks/base/tools/hiddenapi/checksorted_sha.sh ${PREUPLOAD_COMMIT} ${REPO_ROOT} ktlint_hook = ${REPO_ROOT}/prebuilts/ktlint/ktlint.py -f ${PREUPLOAD_FILES} + +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 |