Tools: Allow cherry pick lines in validate-commit.py.

Cherry picking tends to add an extra blank line to the commit message.
Update the body check in validate-commit.py to allow for this.

Revert "tools: Skip over commit body checks." This reverts commit
24450d9c51.

(cherry picked from commit dd6b6f48dc)
This commit is contained in:
Gerald Combs 2020-11-04 11:03:56 -08:00 committed by Gerald Combs
parent b3de664f2b
commit bc09f1a334
1 changed files with 7 additions and 4 deletions

View File

@ -141,6 +141,10 @@ for details.
''')
return False
# Cherry-picking can add an extra newline, which we'll allow.
cp_line = '\n(cherry picked from commit'
body = body.replace('\n' + cp_line, cp_line)
try:
cmd = ['git', 'stripspace']
newbody = subprocess.check_output(cmd, input=body, universal_newlines=True)
@ -184,7 +188,7 @@ def verify_merge_request():
m_r_url = '{}/projects/{}/merge_requests/{}'.format(gitlab_api_pfx, project_id, m_r_iid)
req = urllib.request.Request(m_r_url)
# print('req', repr(req))
# print('req', repr(req), m_r_url)
with urllib.request.urlopen(req) as resp:
resp_json = resp.read().decode('utf-8')
# print('resp', resp_json)
@ -232,9 +236,8 @@ def main():
if exit_code:
print_git_user_instructions()
# Cherry-picking might add extra newlines, so skip this for now.
# if not verify_body(body):
# exit_code = 1
if not verify_body(body):
exit_code = 1
if not verify_merge_request():
exit_code = 1