build: fix check_autogenerated_edits.py flagging up files that didn't exist

Before this change new backend docs would have their changes flagged
which is undesirable for the first revision.
This commit is contained in:
Nick Craig-Wood 2025-06-05 16:37:01 +01:00
parent 210acb42cd
commit 51fd697c7a

View File

@ -77,6 +77,10 @@ def check_file(file):
viol = False viol = False
new_lines = get_file_content("HEAD", file) new_lines = get_file_content("HEAD", file)
old_lines = get_file_content("HEAD~1", file) old_lines = get_file_content("HEAD~1", file)
# If old file did not exist or was empty then don't check
if not old_lines:
return
# Entire autogenerated file check. # Entire autogenerated file check.
if any("autogenerated - DO NOT EDIT" in l for l in new_lines[:10]): if any("autogenerated - DO NOT EDIT" in l for l in new_lines[:10]):