From aa2959dd41629416f34afc0740ed131504c657f0 Mon Sep 17 00:00:00 2001 From: shaq522 Date: Thu, 17 Dec 2020 01:42:00 +0800 Subject: [PATCH] fix(commit): attach user info to backup for permission denied issue When multi users commit in the same machine shared backup will cause permission deny. To resolve this issue, attach user info to the name of backup commit. --- commitizen/commands/commit.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/commitizen/commands/commit.py b/commitizen/commands/commit.py index 09fb2cbbef..4c6f7aa03c 100644 --- a/commitizen/commands/commit.py +++ b/commitizen/commands/commit.py @@ -28,7 +28,10 @@ def __init__(self, config: BaseConfig, arguments: dict): self.config: BaseConfig = config self.cz = factory.commiter_factory(self.config) self.arguments = arguments - self.temp_file: str = os.path.join(tempfile.gettempdir(), "cz.commit.backup") + self.temp_file: str = os.path.join( + tempfile.gettempdir(), + "cz.commit{user}.backup".format(user=os.environ.get("USER", "")), + ) def read_backup_message(self) -> str: # Check the commit backup file exists