Fix repo hook error upon upload
Some lines of the presubmit message are coming back as bytes instead of a string using pyton3. So, ensure each line is a str before checking contents. Also, send code 77 back to ensure that the error message is actually printed Test: repo upload Change-Id: Ieecd6228318b3001098ac45e4767b8bf46826387
This commit is contained in:
parent
9ee28de248
commit
85af7f48e3
|
@ -41,11 +41,14 @@ def main():
|
|||
commit_msg = subprocess.check_output(["git", "show",
|
||||
sys.argv[1], "--no-notes"])
|
||||
for commit_line in commit_msg.splitlines():
|
||||
if re.search(AOSP_COMMIT_TAG_REGEX, commit_line, re.IGNORECASE):
|
||||
_check_aosp_message(commit_line)
|
||||
# Some lines in the commit message will be given to us as bytes
|
||||
commit_line_str = str(commit_line)
|
||||
if re.search(AOSP_COMMIT_TAG_REGEX, str(commit_line_str), re.IGNORECASE):
|
||||
_check_aosp_message(commit_line_str)
|
||||
|
||||
print(ERROR_MESSAGE)
|
||||
sys.exit(0)
|
||||
# Print the warning, but do not fail the presubmit check.
|
||||
sys.exit(77)
|
||||
|
||||
def _is_in_aosp():
|
||||
branch_info = subprocess.check_output(["git", "branch", "-vv"])
|
||||
|
@ -59,7 +62,8 @@ def _check_aosp_message(aosp_line):
|
|||
sys.exit(0)
|
||||
|
||||
print(ERROR_MESSAGE)
|
||||
sys.exit(0)
|
||||
# Print the warning, but do not fail the presubmit check.
|
||||
sys.exit(77)
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
|
Loading…
Reference in New Issue