summaryrefslogtreecommitdiff
path: root/tools/aosp
diff options
context:
space:
mode:
author Christopher Ferris <cferris@google.com> 2021-05-18 13:49:08 -0700
committer Christopher Ferris <cferris@google.com> 2021-05-18 13:49:08 -0700
commit9fbe8a82795a335a5c1452a92c691696dffda4c6 (patch)
tree53af8d708c5b84603dbaa60edc23e346b98c83bc /tools/aosp
parent6c914b4bc61235d6a4ff3cc468de6eac286aadf8 (diff)
Add a cherry-pick exception.
If someone is trying to cherry-pick back to aosp, don't force them to use --no-verify, allow it. Right now, the only form of cherry-pick allowed is: cherry picked from Test: Ran on a commit with the message and without and observed that Test: with the cherry pick message, no error, without, error message. Change-Id: I27581f782cdc1a1c4fa207a3aae392c0d434eb5a
Diffstat (limited to 'tools/aosp')
-rwxr-xr-xtools/aosp/aosp_sha.sh16
1 files changed, 15 insertions, 1 deletions
diff --git a/tools/aosp/aosp_sha.sh b/tools/aosp/aosp_sha.sh
index f25fcdcb7479..514f17a042bc 100755
--- a/tools/aosp/aosp_sha.sh
+++ b/tools/aosp/aosp_sha.sh
@@ -5,7 +5,21 @@ if git branch -vv | grep -q -P "^\*[^\[]+\[aosp/"; then
# Change appears to be in AOSP
exit 0
else
- # Change appears to be non-AOSP; search for files
+ # Change appears to be non-AOSP.
+
+ # If this is a cherry-pick, then allow it.
+ cherrypick=0
+ while read -r line ; do
+ if [[ $line =~ cherry\ picked\ from ]] ; then
+ (( cherrypick++ ))
+ fi
+ done < <(git show $1)
+ if (( cherrypick != 0 )); then
+ # This is a cherry-pick, so allow it.
+ exit 0
+ fi
+
+ # See if any files are affected.
count=0
while read -r file ; do
if (( count == 0 )); then