Skip to content

Commit 2aa63ea

Browse files
Support Git submodules
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
1 parent 1c13aa7 commit 2aa63ea

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

tests/scripts/check_files.py

+7
Original file line numberDiff line numberDiff line change
@@ -321,6 +321,7 @@ class TabIssueTracker(LineIssueTracker):
321321
".make",
322322
".pem", # some openssl dumps have tabs
323323
".sln",
324+
"/.gitmodules",
324325
"/Makefile",
325326
"/Makefile.inc",
326327
"/generate_visualc_files.pl",
@@ -481,6 +482,12 @@ def collect_files():
481482
bytes_output = subprocess.check_output(['git', 'ls-files', '-z'])
482483
bytes_filepaths = bytes_output.split(b'\0')[:-1]
483484
ascii_filepaths = map(lambda fp: fp.decode('ascii'), bytes_filepaths)
485+
# Filter out directories. Normally Git doesn't list directories
486+
# (it only knows about the files inside them), but there is
487+
# at least one case where 'git ls-files' includes a directory:
488+
# submodules. Just skip submodules (and any other directories).
489+
ascii_filepaths = [fp for fp in ascii_filepaths
490+
if os.path.isfile(fp)]
484491
# Prepend './' to files in the top-level directory so that
485492
# something like `'/Makefile' in fp` matches in the top-level
486493
# directory as well as in subdirectories.

0 commit comments

Comments
 (0)