pre-upload: allow some more tags in cherry picked patches
It turns out a couple of common tags were missed when the list of the
tags allowed in the last paragraph of the commit message was defined.
'Commit-Queue:' added by gerrit when the original patch is checked in
in some cases, and '(cherry picked from commit...' which can be
showing up more than once in case a patch was cherry picked more than
Let's add these to the list of allowed tags to avoid false positives
when cherry picking into branches.
TEST=verified that proper error message is generated for different
inputs, and that valid tags do not trigger pre-submit errors any
Signed-off-by: Vadim Bendebury <email@example.com>
Reviewed-by: Guenter Roeck <firstname.lastname@example.org>
diff --git a/pre-upload.py b/pre-upload.py
index c061f4f..2ef303f 100755
@@ -971,12 +971,16 @@
allowed_tags = ['Signed-off-by']
end = desc[m.end():].strip().splitlines()
- if end and end[-1].startswith('(cherry picked from commit'):
+ cherry_pick_marker = 'cherry picked from commit'
+ if end and cherry_pick_marker in end[-1]:
# Cherry picked patches allow more tags in the last paragraph.
- allowed_tags += ['Reviewed-on', 'Reviewed-by', 'Commit-Ready', 'Tested-by']
+ allowed_tags += ['Commit-Queue', 'Commit-Ready', 'Reviewed-by',
+ 'Reviewed-on', 'Tested-by']
end = end[:-1]
- tag_search = '^(%s): ' % '|'.join(allowed_tags)
+ # Note that descriptions could have multiple cherry pick markers.
+ tag_search = r'^(%s:|\(%s) ' % (':|'.join(allowed_tags), cherry_pick_marker)
if [x for x in end if not re.search(tag_search, x)]:
return HookFailure('Only "%s:" tag(s) may follow the Change-Id.' %