Couple of minor fixes & improvements for files linter test added in #21740
Use a context manager when opening files, so that files are closed are we are done with them
Use the
-zflag when shelling out togit ls-filesso that we can catch newlines and other weird control characters in filenames.
From the git ls-files manpage:
-z \0 line termination on output and do not quote filenames. See OUTPUT below for more information.
Without the -z option, pathnames with "unusual" characters are quoted as explained for the configuration variable
core.quotePath (see git-config(1)). Using -z the filename is output verbatim and the line is terminated by a NUL byte.