Handle deleted files correctly

Don't attempt to run on a file that isn't present now.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
This commit is contained in:
Gilles Peskine 2023-06-25 22:18:40 +02:00
parent 43838b8a24
commit 163ec4090e

View file

@ -74,21 +74,18 @@ def get_src_files(since: Optional[str]) -> List[str]:
Only C files are included, and certain files (generated, or 3rdparty) Only C files are included, and certain files (generated, or 3rdparty)
are excluded. are excluded.
""" """
if since is None: file_patterns = ["*.[hc]",
git_ls_files_cmd = ["git", "ls-files", "tests/suites/*.function",
"*.[hc]", "scripts/data_files/*.fmt"]
"tests/suites/*.function", output = subprocess.check_output(["git", "ls-files"] + file_patterns,
"scripts/data_files/*.fmt"] universal_newlines=True)
output = subprocess.check_output(git_ls_files_cmd,
universal_newlines=True)
else:
git_ls_files_cmd = ["git", "diff", "--name-only", since, "--",
"*.[hc]",
"tests/suites/*.function",
"scripts/data_files/*.fmt"]
output = subprocess.check_output(git_ls_files_cmd,
universal_newlines=True)
src_files = output.split() src_files = output.split()
if since:
output = subprocess.check_output(["git", "diff", "--name-only",
since, "--"] +
src_files,
universal_newlines=True)
src_files = output.split()
generated_files = list_generated_files() generated_files = list_generated_files()
# Don't correct style for third-party files (and, for simplicity, # Don't correct style for third-party files (and, for simplicity,