def find_invalid_filenames(filenames, repository_root):
errors = []<EOL>for filename in filenames:<EOL><INDENT>if not os.path.abspath(filename).startswith(repository_root):<EOL><INDENT>errors.append((filename, '<STR_LIT>'<EOL>'<STR_LIT>' % (filename, repository_root)))<EOL><DEDENT>if not os.path.exists(filename):<EOL><INDENT>errors.append((filename,<EOL>'<STR_LIT>' % (filename, )))<EOL><DEDENT>if os.path.isdir(filename):<EOL><INDENT>errors.append((filename,<EOL>'<STR_LIT>'<EOL>'<STR_LIT>' % (filename, )))<EOL><DEDENT><DEDENT>return errors<EOL>
Find files that does not exist, are not in the repo or are directories.

    Args:
      filenames: list of filenames to check
      repository_root: the absolute path of the repository's root.

    Returns: A list of errors.