From 852af6ac35574b588433dfe442a6d5019eed170d Mon Sep 17 00:00:00 2001 From: Victor Hsieh Date: Fri, 7 Apr 2023 08:25:50 -0700 Subject: PREUPLOAD hook to nudge sending code review to upstream Ignore-Upstream-First: Only applicable to Android as downstream Bug: None Test: repo upload # both cases Change-Id: Ia5353829903a531e395cbd4a5c24ca63f9b83ae7 --- PREUPLOAD.cfg | 3 +++ tools/repo_upload_warning | 21 +++++++++++++++++++++ 2 files changed, 24 insertions(+) create mode 100755 tools/repo_upload_warning diff --git a/PREUPLOAD.cfg b/PREUPLOAD.cfg index 254a062..c7d9e54 100644 --- a/PREUPLOAD.cfg +++ b/PREUPLOAD.cfg @@ -3,3 +3,6 @@ clang_format = true [Builtin Hooks Options] clang_format = --commit ${PREUPLOAD_COMMIT} --style file --extensions c + +[Hook Scripts] +repo_upload_warning = ./tools/repo_upload_warning ${PREUPLOAD_COMMIT} diff --git a/tools/repo_upload_warning b/tools/repo_upload_warning new file mode 100755 index 0000000..3333eba --- /dev/null +++ b/tools/repo_upload_warning @@ -0,0 +1,21 @@ +#!/usr/bin/env bash + +if git log -n 1 --format='%B' $1 | grep -q -E "^Ignore-Upstream-First: .+" ; then + # Change is explicitly marked as ok to skip upstream + exit 0 +elif git log -n 1 --format='%s' $1 | grep -q -E "^(UPSTREAM|Upstream): .+" ; then + # Change is explicitly marked as coming from the upstream + exit 0 +fi + +echo "WARNING: Here is not the upstream." +echo "" +echo "Do not submit changes to this repository directly. Please submit changes to upstream" +echo "from https://chromium-review.googlesource.com/q/project:chromiumos/platform/minijail" +echo "" +echo "If the change is from the upstream, please prepend \"UPSTREAM: \" to the subject." +echo "" +echo "If indeed necessary, please add \"Ignore-Upstream-First: \" to commit message" +echo "to bypass." + +exit 1 -- cgit v1.2.3