summaryrefslogtreecommitdiff
path: root/tools/aosp/aosp_sha.sh
diff options
context:
space:
mode:
authorJeff Sharkey <jsharkey@android.com>2018-08-23 22:01:53 -0600
committerJeff Sharkey <jsharkey@android.com>2018-09-11 11:09:05 -0600
commit0a9c731969fe590f82a5a4e34f9f1470d57d20b2 (patch)
tree235dfb994eef432c2753e85cfab3558fa2e96268 /tools/aosp/aosp_sha.sh
parent98627fa455f34da2791d2d65e30d38e87bee3022 (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 Merged-In: I113e63b6133f20389d84ec0d6d8b81cdbdf35d38
Diffstat (limited to 'tools/aosp/aosp_sha.sh')
-rwxr-xr-xtools/aosp/aosp_sha.sh18
1 files changed, 18 insertions, 0 deletions
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