@contextmanager<EOL>def files_to_check(commit_only):
global TEMP_FOLDER<EOL>safe_directory = tempfile.mkdtemp()<EOL>TEMP_FOLDER = safe_directory<EOL>files = get_files(commit_only=commit_only, copy_dest=safe_directory)<EOL>try:<EOL><INDENT>yield files<EOL><DEDENT>finally:<EOL><INDENT>shutil.rmtree(safe_directory)<EOL><DEDENT>
Validate the commit diff.

Make copies of the staged changes for analysis.