From 6e3975ef0139c2a3c748710db134905bbad96b24 Mon Sep 17 00:00:00 2001 From: Adam Johnson Date: Fri, 16 Apr 2021 16:43:54 +0100 Subject: [PATCH] Include PID in patch filename Fixes #1880. --- pre_commit/staged_files_only.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pre_commit/staged_files_only.py b/pre_commit/staged_files_only.py index 617930102..bdd3df9b9 100644 --- a/pre_commit/staged_files_only.py +++ b/pre_commit/staged_files_only.py @@ -47,7 +47,7 @@ def _unstaged_changes_cleared(patch_dir: str) -> Generator[None, None, None]: retcode=None, ) if retcode and diff_stdout_binary.strip(): - patch_filename = f'patch{int(time.time())}' + patch_filename = f'patch{os.getpid()}-{int(time.time())}' patch_filename = os.path.join(patch_dir, patch_filename) logger.warning('Unstaged files detected.') logger.info(f'Stashing unstaged files to {patch_filename}.')